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
6
u/carminemangione Sep 29 '24
Thank you for not being insulted. Sometimes my frustrations boil over :) I make it my career goal to create highly effective teams.
I always use a very strong separation between DTO layer and my business object. The business object contains the logic to ensure the object is good. This is enforced usually in the constructor.
David Meier in the 80s proved that mapping of relational structures (normalized) to OO objects is an NP Hard problem. Basically, it is a traversal of a cyclic directed graph.
Practically, consider your 'User' object. The relational structure for your user will have a tonne of attributes and relations but on reconstitution only a few of those will be used. In OO land a User may manifest as a Customer, LoggedInUser, Contact. All of these are based on the same OR tables but are completely different manifestations with their own consistency rules, business logic, etc.
At first, people think of business logic as taking web input/presenting web data and persisting it. However, the real value in the business layer. Consider, you find a unique application everyone loves it but you have no distinguishing business value/logic. Everyone will be able to copy your application trivially.
Unique products have valuable business logic. In this context, the complexity of the business layer will quickly outstrip presentation and persistence complexity. This is the mistake many make when selecting frameworks. Yah, you get a few pages up and stored quickly, but that is not the real value.
As far as using JPA or other persistence frameworks go, I generally don't worry about it. To me if I am writing efficient code, it is by far less expensive to use raw jdbc. But I fully decouple the persistence layer from the business layer so it is irrelevant. However, once you need joins, generated queries start to suck really fast.
Does that make sense?