Live data from Hacker News

Lombok Saved My Ass

devolution.tech

11–20 of 60 posts

Re: Lombok Saved My Ass

#11
While I can understand why somebody would want to use Lombok, this is actually very misguided.

If you want to program in better language, just go and use better language.

The most important strength of Java and basically the only reason it is being used is that the code is simple to understand (simplistic!), everything is easily trace-able and debuggable and that you get fantastic tools that know everything about code and can provide you safe operations on huge code bases (refactoring, finding usages, tracing and understanding code paths, etc.)

Lombok and new Java features decrease reliability of tools removing Java's biggest strength.

Re: Lombok Saved My Ass

#12
post #11

While I can understand why somebody would want to use Lombok, this is actually very misguided. If you want to program in better language, just go and use better language. The most important strength of Java and basically the only reason it is being used is that the code is simple to understand (simplistic!), everything is easily trace-able and debuggable and that you get fantastic tools that know everything about cod…

I have the complete opposite point of view. I never used @Cleanup but at least the @Data annotation makes it much more readable IMO.

There is tons of boilerplate in a simple Java bean, so when you have 3 pages of getters/setters, equals, hashcode, toString etc... and someone introduces something hacky it doesn't jump out at you.

To be fair, it doesn't have to be a hack, but it's doing something weird that's unexpected.

Then if I use @Data and I still see a Getter/Setter defined it calls it to my attention since odds are i'm doing something different.

ie. Oh, you're parsing a string get a numeric value and then setting it with a fallback value/exception. Okay good to know. If it screws up at least I know there is a special behavior here.

Lombok makes these patterns much easier to read though I prefer to only use it for repeat code. Saving one line so you can have @Cleanup doesn't seem worth it to me. It hides too much as you said above, but it varies on the use case.

Re: Lombok Saved My Ass

#13

Earlier quoted context omitted.

I used Lombok back in the day (never by choice). It's somewhat useful but I never really liked code generation and always felt it's a bit of a kludge and it indeed confused the hell out of intellij regularly (which is not that hard, it gets confused all the time). It's syntactic sugar. A bit of a stop gap to make Java look a bit more like several other decent languages out there. Kotlin is indeed far superior and an…

FWIW Lombok enhances byte code, I don’t think it does code generation. Code generation is awesome specially when it works ;)

I don't know whether Lombok routinely generates source or bytecode, but its “delombok” command can definitely generate the equivalent Java boilerplate for whatever you use.

Re: Lombok Saved My Ass

#14
post #11

While I can understand why somebody would want to use Lombok, this is actually very misguided. If you want to program in better language, just go and use better language. The most important strength of Java and basically the only reason it is being used is that the code is simple to understand (simplistic!), everything is easily trace-able and debuggable and that you get fantastic tools that know everything about cod…

For non-toy projects, those strengths greatly outweigh the language's flaws.

Re: Lombok Saved My Ass

#16

Earlier quoted context omitted.

I used Lombok back in the day (never by choice). It's somewhat useful but I never really liked code generation and always felt it's a bit of a kludge and it indeed confused the hell out of intellij regularly (which is not that hard, it gets confused all the time). It's syntactic sugar. A bit of a stop gap to make Java look a bit more like several other decent languages out there. Kotlin is indeed far superior and an…

Agreed - lombok is a kludge for language features, but back when it was big there weren't a lot of alternatives beyond switching to an entirely new language and stack (a tough thing to sell in large enterprise). Regarding IDE support - I was once on a project using Lombok where some developers used Eclipse and others used IntelliJ. The Eclipse devs wanted to use this new @Builder annotation, which didn't work on Inte…

I've used a few pojo-gen libraries, but they've never had good integrations or workflows with IDEs, and they usually led to a flakier build. Editing the definition file was never as good as editing a real class.

Re: Lombok Saved My Ass

#17
post #11

While I can understand why somebody would want to use Lombok, this is actually very misguided. If you want to program in better language, just go and use better language. The most important strength of Java and basically the only reason it is being used is that the code is simple to understand (simplistic!), everything is easily trace-able and debuggable and that you get fantastic tools that know everything about cod…

I have the complete opposite point of view. I never used @Cleanup but at least the @Data annotation makes it much more readable IMO. There is tons of boilerplate in a simple Java bean, so when you have 3 pages of getters/setters, equals, hashcode, toString etc... and someone introduces something hacky it doesn't jump out at you. To be fair, it doesn't have to be a hack, but it's doing something weird that's unexpecte…

> but at least the @Data annotation makes it much more readable IMO.

Record types for Java are being worked on, and we should be getting them hopefully at some point in the (near) future.

Re: Lombok Saved My Ass

#18
post #4

I used Lombok many years ago, but stopped. Modern Lompoc, with tools like delomboc to generate plain Java source code, and better tooling support beyond Eclipse makes Lompoc look pretty good now (if I still used Java). Cool project.

What is "lompoc" coz google does not help me find it??

It’s a city in Southern California, obviously.
Post reply on HN