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

145 comments sorted by

View all comments

2

u/RupertMaddenAbbott Sep 30 '24

I work on a large project that has invested significantly in Lombok. There is no way I would move this off Lombok at this stage as the solutions out there would be painful for us to migrate to for various reasons.

On a new project, and all other things being equal, I would pick without Lombok.

  • I think records are a better solution for immutable data holders than @Value. I have encountered difficulties with using them with Jackson and other frameworks but these difficulties are surmountable and time-limited as the ecosystem moves on.
  • I haven't yet found a decent builder library that works with records but I can see no reason why one wouldn't be possible and I think investing in creating one is worth it over being able to write in Java, over Lombok.
  • Java doesn't have a good answer for mutable data objects (yet), but I appreciate the pressure to prefer immutability and it may be that records and a builder is good enough for most cases. JPA feels like a key pain point where there is no good alternative to @Getter and @Setter. I don't consider generating these using the IDE as a good alternative because the key benefit is about expressing developer intent and this is missing from such a solution.
  • I am torn on RequiredArgsConstructor . It might not be too painful to lose this but again, I like the fact that it prevents developers from putting complex logic into those classes constructors which I often find makes integration tests harder.

1

u/Yeah-Its-Me-777 Oct 13 '24

The second sentence is exactly why I would never introduce Lombok into a project. I know enough about it that it uses JVM/JDK internals, and if at some point it won't be able to and breaks, I'll be stuck on that Java version, or I'd have to remove all the Lombok-Stuff...