ipl-dashboard
ipl-dashboard copied to clipboard
Added lombok dependency
Added lombok dependency to reduce verbosity of code.
Hi @nirvana124 ! Nice improvement! I agree that adding lombok will decrease boilerplate code. But, I believe you are messed one thing here:
- MatchInput its just a POJO, it shouldn't know anything about conversion one entity to another
- You are misusing @builder(toBuilder) annotation in Team.java Best regards, Maks
@mvoronov Thanks for review.
If we are adding any method about conversion in POJO we can consider it as a class and not a POJO :)
It increases the code readability but i think in this project we already have MatchDataProcessor
for conversion.
Can you please elaborate on point 2 ?
Hi @nirvana124 ! Nice improvement! I agree that adding lombok will decrease boilerplate code. But, I believe you are messed one thing here:
- MatchInput its just a POJO, it shouldn't know anything about conversion one entity to another
- You are misusing @builder(toBuilder) annotation in Team.java Best regards, Maks
@mvoronov Thanks for review.
If we are adding any method about conversion in POJO we can consider it as a class and not a POJO :) It increases the code readability but i think in this project we already have
MatchDataProcessor
for conversion.Can you please elaborate on point 2 ?
Hi @nirvana124 ! I mean why don't simply do like it was originally? Could you explain what is the benefit of using toBuilder in this piece of code?
Team team = this.teamRepository.findByTeamName(teamName);
return team.toBuilder().matches(matchRepository.findLatestMatchesbyTeam(teamName,4)).build();
Hi @nirvana124 ! I agree with @mvoronov point here. For Team class creating a builder pattern is not adding any values. Normally if a constructor of a class becomes more complex (wherein it accepts more than 7 params), that is one of the scenario beneficial for Builder Pattern.
Hi @nirvana124 ! I agree with @mvoronov point here. For Team class creating a builder pattern is not adding any values. Normally if a constructor of a class becomes more complex (wherein it accepts more than 7 params), that is one of the scenario beneficial for Builder Pattern.
Well, it also might be a true, but my point mainly was about "toBuilder" option.
Thanks for your feedback :) Below are the reasons why I have used builder and toBuilder Builder: It makes code more readable, It removes verbosity. You can see in one single line for what parameters you are setting the values.
toBuilder: You can see there is a team object which is returned by repository.
I used toBuilder on team object which is creating a new object and not changing existing team
object.
Team team = this.teamRepository.findByTeamName(teamName); return team.toBuilder().matches(matchRepository.findLatestMatchesbyTeam(teamName,4)).build();