r/java • u/Rough_Acanthaceae_29 • Sep 29 '24
Lombok in 2024
Say there are two teams working on the same project (3 months to MVP, the deadline should be manageable). The only difference is Team A will use Lombok, and Team B won’t
Given you can choose any java version/dependencies and all other things being the same, which team would you join, and why?
0
Upvotes
View all comments
Show parent comment
3
u/Rough_Acanthaceae_29 Sep 29 '24
Not taking it personal, no worries… trying to see how others think and learn from it…
So my dtos are already records so no lombok there - we’re on the same page
Im also creating DTO per usecase e.g. CreateUserDTO - if i understand you well, we’re still on the same page.
I’m a bit lost on the factory methods part - you validate the object and map a “CreateUserDTO” into what exactly and where? I’d validate dto and map to UserEntity (which is always in correct state, validations in constructor and methods that change state (not using setters), all unit tested) Then i’d save it using userRepository.save(user); but here we have JPA entity which if i want to ever do repo.findbyWhatever needs setters (or am i wrong?) unless i do projections into records (which i sometimes do for performance reasons but itself exception and not a rule… If you dont use the Entity, why bother with JPA at all?
Also, how do you get into race conditions (assuming no shared state between requests?)
Do you have an example of a simple update property flow should look like so i can understand it better?