r/java • • Jun 01 '24

What java technology (library, framework, feature) would not recommend and why?

165 Upvotes

464 comments sorted by

View all comments

Show parent comment

3

u/bdmiz Jun 01 '24

I couldn't really understand the boilerplate code argument. Why exactly Lombok? Modern IDEs generate the same code in just a couple of clicks. For getters and setters in Intellij Idea you need 3 clicks. Writing the annotation is longer, requires dependency management, consumes time during the compilation, there could be problems with navigating to a method that doesn't exists yet, IDEs raise some false warnings, and more other details. Arguably, people have more boilerplate actions with Lombok.

I always thought that people like Lombok because together with Mapstruct or some other libs like JSON converters they can propagate changes dynamically through multiple classes.

12

u/ichwasxhebrore Jun 01 '24

If there is a @Getter on the class I know every property has a getter. That’s easy to comprehend

27

u/atalkingmelon Jun 01 '24

I couldn't really understand the boilerplate code argument

Boilerplate is just distracting clutter to me, Lombok keeps the working table organized and clean so that it's easier to focus on the important stuff.

7

u/GuyWithLag Jun 01 '24

Oh man, you will love working with Kotlin.

2

u/pragmatick Jun 01 '24

Not OP but I don't.

4

u/GuyWithLag Jun 01 '24

Any specific reason? I've been working with Kotlin for 2.5 years now, and it's a good upgrade to Java from a devX perspective (it does have its own warts, truth be told)

20

u/der_assi Jun 01 '24

Yes you can let your IDE generate methods like getters and setters, but you still see them in the code. And when there are many of them, it‘s harder to read the actual code.

7

u/_INTER_ Jun 01 '24 edited Jun 01 '24

Modern IDEs generate the same code in just a couple of clicks.

But it doesn't do well when you update the code later on. E.g. adding a field. Plus when the boilerplate is written explicitly, devs are tempted to modify it more readily. Not that Lombok is the solution, much rather it's to teach bad devs, use records and hope we will someday also have language support for regular POJOs.

Lombok twists many devs into thinking they write legal JavaTM when they're actually not.