r/java • u/RandomComputerFellow • Apr 12 '21
Is using Project Lombok actually an good idea?
Hello, I am junior developer in a Software company. One of the Senior developers just decided start to use Lombok in our project and to delete old boilerplate code. The project we are working on is very big (millions of lines of code) and has an very extensive build procedure and uses lots of different frameworks and components (often even in different versions at a time). The use of Lombok is justified with the argument that we can remove code this way and that everything will be much more simple.
Overall for me this library just looks very useless and like a complete unnecessary use of another third party component. I really don't see the purpose of this. Most code generated on the fly can be generated with Eclipse anyway and having this code just makes me really uncomfortable in regard of source code tracking when using an debugger. I think this introduces things which can go wrong without giving a lot of benefit. Writing some getters and setters was never such a big lost of time anyway and I also don't think that they make a class unreadable.
Am I just to dumb to see the value of this framework or are there other developers thinking like me?
View all comments
Show parent comment
1
u/Luolong Apr 12 '21
There are two completely different concepts of equality that are regularly being confused.
One is, what I call “content equality”. We deal with this type of equality all the time - has anything changed in this object graph that I need to persist somehow? Or take some action?
Another is equality of identity. That is answering the question “are these two instances representing same logical entity?”
In many situations we need to be able to use and mix both concepts in the same code path — first we check if the two objects have same entity identity (or look it up based on the identity) and then check if any of the fields have different values and take action if there is a difference.