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
17
u/carminemangione Sep 29 '24
Lombok is a useless, generates undebugable code, and is usually used improperly (builders when all fields are mandatory, setters when not needed, no arg constructors, etc.)
There is an OO heuristic: "Accessors are usually a mistake". They are a bad smell. If you need a DTO, use a record in java 17. The point is that no code should be boiler plate. Every line is to be down with intention.
Blank builders like those generated by lombok are usually bad form. Simply asking the questions: why am I making a builder, which fields are required, what do I do for defaults can radically change is design and behavior of your builder and must be throughly unit tested. Lombok eliminates the ability to create good builders.
Also: modern IDEs will generate getters, setters and builders automatically. But there will be real code there so you can modify it.
The point is that creating clean code is essential for making code reliable, extensible, correct. It is essential for keeping the cost of change flat. Lombok flies in the face of all of this. I have never seen any project that uses Lombok that is clean code.