4 ms·
Is anyone not using Lombok these days? I haven’t written a getter or a setter in years.
by nsxwolf 6y ago
Is anyone not using Lombok these days? I haven’t written a getter or a setter in years.
- pjmlp 6y agoI never used and never plan to. Don't need bytecode magic that my IDE can do for me.
- rufus_foreman 6y agoI'm not a fan but the place where I work now uses it and it doesn't bother me as much as I thought it would. IDEs are smart enough to work with it. Although I still wouldn't use it on a project of my own.
- nsxwolf 6y agoA bean with nothing but fields and a couple annotations is much cleaner and smaller than one full of generated getter/setter code. And I can rename a field without having to fumble around with the IDE to regenerate them.
- pjmlp 6y agoNever learned to use code navigation tools and respective IDE filters?
- nsxwolf 6y agoThose aren’t as good as just using Lombok.
- pjmlp 6y agoIndeed, they don't provide the pleasure to dig out bugs caused by mishandling bytecodes or the verifier.
- petersellers 6y agoAre you referring to code folding? Stuff like that helps but it's still not as good as Lombok just generating the getters and setters for you. I'm not sure if IntelliJ can filter out some of the other stuff Lombok can generate (builders, value objects, constructors, etc.)
- pjmlp 6y agoLombok generates too much for its own good.
- marvy 6y agoConsider the following two cases: 1. MyClass has 10 private fields, each with a trivial getter and setter. 2. YourClass has 10 private fields, of which 9 have a trivial getter and setter. The last one has a trivial getter but the setter is non-trivial. If you use your IDE to write your getters and setters, than the two classes above will look the same at glance. If you use Lombok, the "special" field will stick out at once. Personally, I prefer to avoid Lombok and just use public fields. That way, the field with a nontrivial setter will also stick out, and no need for bytecode magic.
- pjmlp 6y agoWhen I use my IDE, I use its code navigation features to my profit.
- marvy 6y agoOkay now I'm curious: what IDE do you use that makes this a non-issue?
- pjmlp 6y agoEclipse, here are some tips. - Ctrl + shift + T => search for types - Ctrl + O => search for methods - Ctrl + T => switch between classes - Filters, https://help.eclipse.org/2020-12/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Fconcepts%2Fconcept-java-views-filtering.htm https://help.eclipse.org/2020-12/index.jsp?topic=%2Forg.ecli...
- diroussel 6y agoThere is no magic. You have source code and when you compile you get byte code. In the early versions of Lombok it was a bit dodgy as it used private APIs, but now the compiler has the public hooks and its all good honest compiler plugins.
- u678u 6y agoAgreed Lombok is nice, but why can't they just put that in the runtime? You have to be suspicious of every extra package.
- JackFr 6y agoWorking with java for 20 years. Have never used Lombok, and honestly don’t personally know anyone who has. (Same with Kotlin.) It’s a big world. (Another weird thing for the first 25 years of my career never used anything but Sybase as a relational database — across 5 different firms. Never used Oracle or SQL Server.)