4 ms·
Kind of off topic, but is something using either Lombok[0] or Manifold[1] to have better ergonomics in Java? It sounds like a brilliant idea to me, but I don't
by haolez 6y ago
Kind of off topic, but is something using either Lombok[0] or Manifold[1] to have better ergonomics in Java? It sounds like a brilliant idea to me, but I don't use Java on a daily basis.
[0] https://projectlombok.org/ https://projectlombok.org/
[1] https://github.com/manifold-systems/manifold https://github.com/manifold-systems/manifold
- windock 6y agoLombok is very widely used in places I worked. Love it myself.
- deleted 6y ago[deleted]
- virmundi 6y agoThe problem I have with Lombok is that suddenly it’s hard to trace getters and setter from the Pojo. By this I mean asking the question, “where is getId() used” is hard if I want to use the find references feature of the IDE.
- lmilcin 6y agoI also have mixed feelings about Lombok. For example, if you want to automatically create getters and setters to all private variables, why not make them public in the first place? I hate when tools mess with IDE. What about guys using Emacs (or any other editor that does not understand Lombok)? I think generating code from IDE is fine as well as having code generated from build system distributed along with code, but having that code generated through magic of annotation processor is not as nice. I also suspect that Lombok messes my IDE on a deeper level but I have not yet a good concrete proof. Recently I am more and more frequently finding situations where Idea messes up understanding correct types of things and it takes for it some time to catch up (and sometimes reloading the file). On the other hand I love small things like creating builder or logger. Which is to say these can be just as easily generated from a template, no annotation processor needs to be involved. I think main feature of Java for many years were its IDEs which would allow to run accurate refactorings or always understand who is using particular piece of code, what is exact call hierarchy, etc. I feel loosing that is going to make Java much less useful for me when I try to analyze large project or run huge refactorings.
- p2t2p 6y ago> why not make them public in the first place? Because in future I may want to add some validation there, or processing, like sending events on set of a value, etc. Properties in C# was a genius move that solves it correctly.
- lmilcin 6y agoThat, in my observation, almost never happens.
- p2t2p 6y agoI'm working in a product that is about 10 years old and 4 months ago it went through a quite a big project which purpose was to add extended auditing to be more enterprise friendly. The system was flooded with auditing events on various changes into internal data. The system provides a public API and allows to install plugins. If we had to change our entities that would be a compatibility nightmare for thousands of plugin vendors.
- watwut 6y agoUnless we are talking about API, then you add getter and setter. You might even be able to refactor all callers automatically via IDE. I mean, I dont mind getters and setters in java, it is standard at this point. But origin of it is in EJB specification, it is not something that would be interently needed elsewhere. It just "feels wrong" to programmers (including me) at this point.
- goostavos 6y ago>why not make them public in the first place? If you're in an old school "OOP" style java codebase, where each class is its own little island of encapsulated state and behavior, the coupling of the two means that strictly controlling access via getters is usually required. Even in more "modern" java, where you do most of your programing against plain data, having Lombok attach getters still gives you some quality of Life benefits because you can use method reference rather than anonymous functions for high-order access (e.g. `things.map(MyClass::getName)` rather than `things.map(myclass -> myclass.name)`) I'm with you on mixed Lombok feelings, though. It's great right up until its not. It fails or doesn't work in really unexpected or weird ways, and is the source endless pain when you've got other annotation based things (like dagger) which then imposes annotation processing order failures.
- v-erne 6y agoI'm not sure how this works in other IDEs, but lombock Eclipse plugin kinda solves this problem. You can run CTRL+Shift+G (Find references) on getter/setter that is shown in class outline and it will immediately give You getter/setter uses. https://stackoverflow.com/questions/42644923/eclipse-with-lombok-search-for-getter-and-setter-usages https://stackoverflow.com/questions/42644923/eclipse-with-lo...
- LgWoodenBadger 6y agoDepends on your IDE. IntelliJ IDEA supports this with the Lombok plugin
- setheron 6y agoNever heard of manifold. Thanks for sharing.
- watwut 6y agoWe use it, but I don't like it. I does superficial stuff for me, but also makes navigating and reading code harder. It takes somewhat more time to figure out all setter callers and stuff like that. It is one of those things that does not much useful, but takes away only little bit so there is no reason to fight it too much.
- dehrmann 6y agoAt least with Lombok, I've found it makes builds and tooling flaky, so I'd rather write an extra line here and there (or use Kotlin).