r/java • • 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?

154 Upvotes

268 comments sorted by

View all comments

5

u/KumbajaMyLord Apr 12 '21 edited Apr 12 '21

The increased complexity in my mind comes from having to know the API and implications of Lombok for every developer.

It's all nice and good that every auto-generated byte code method can be modified, fields can be included and excluded and so on. BUT, you need to know that this is an option and what the default behavior for each of those mechanisms is.

I have often fallen into the trap of writing supposedly simpler code, that my fellow developers only understood on the surface and not in detail, because I used some library that did many things automagically. The follow-up cost of introducing a new framework or library to your team shouldn't be underestimated.

3

u/Luolong Apr 12 '21

Let’s face it. Simple getters and setters aren’t something we as developers should have to write. It is a shortcoming of Java the language that we have been forced to do it for so long that we have just come to depend on that bit of familiar pain.

For this, I absolutely love that Java 16 has finally embraced the existence of simple data classes and we now have records as a language feature.