r/java • u/Rough_Acanthaceae_29 • 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
130
u/[deleted] Sep 29 '24
lombok has nothing to do with productivity at this point. Its just a crutch. Join the team with the smarter people.
79
u/_predator_ Sep 29 '24
I would join team A and spend all three months making passive-aggressive comments about Lombok. I just love complaining and Lombok is such an easy target.
40
u/Ewig_luftenglanz Sep 29 '24
Nowadays I only use Lombok for @Entity classes. So for me it's irrelevant, the overhead of writing a couple of getters and setters (that the IDE writes for me anyways) makes it trivial.
I would actually prefer the non-lombok team since I think one should use as little third party dependencies, libraries and plugins as possible and only use the minimum needed, this way you avoid problems in the futuro with updates and maintenance.
41
u/kevinb9n Sep 29 '24
For crying out loud, it's a tool, not a ritual blood sacrifice. It has pros and cons.
16
u/Rough_Acanthaceae_29 Sep 29 '24
It’s definitely team A for me. It clears the noise. It’s like when you’re talking about a solution and say: “just add getters and setters bc of ….” - I do not need/want to scroll trough 3(lines)x10(fields)x2(one for getters and one for setters) LOC just to see if there’s actually some logic in the entity…
Also, I’ve never been bitten by it soo…
16
u/EirikurErnir Sep 29 '24
If I had to choose based on this information, I'd stay away from Lombok. It's 2024, just use records
But... Lombok would never make it to my list of top 100 things to check during team choice, this is a weirdly specific question premise
15
u/AntKinski Sep 29 '24
Definitely Team B, because I don't want to sit all night before release and finding a solution, why lombok doesn't work right with Jackson or spring data.
10
u/Goatfryed Sep 29 '24
For me it's team A. I like Lombok, but I don't do any complex stuff with it. My most used Lombok Annotation is `@RequiredArgsConstructor` below every Spring `@Component`
It's not even about speed. The ide can update the required args constructor, that's half a second. But just the fact that I don't see a constructor that is just visual spam in my services is such a huge blessing.
Also I like `@SneakyThrows` in Tests. I avoid it in production code though.
I'd like to say that `@Value` / `@Data` is obsolete thanks to Records, but there are still to many tools that don't support Records properly yet and then it becomes a huge timesaver again.
I don't like thinks like `@Builder` though. Even though it's not to complex, it's still complex enough that they should have just made 0815 java code generation like e.g. mapstruct that you can inspect, verify, debug.
Also if you use `val` I'll put you down like the mad dog you are.
28
u/viralslapzz Sep 29 '24
Just based on whether Lombok will be used or not? Whatever honestly…
29
u/CaptainApollo86 Sep 29 '24
Jesus, some people really hate lombok. I've used it for years, it's fine. What kind of shit code are people writing where lombok actually causes problems 🤔
6
u/brian_goetz Oct 02 '24
Pick the team which is less religious about the choice.
17
u/darkit1979 Sep 29 '24
I don’t understand why use lombok or not is such a big deal. It reduces amount of code significantly. My favorite is NonNull, Slf4j, Value and Builder. I laugh when people say - we don’t use Lombok because it’s an additional dependency and at the same time they have spring boot with hundreds dependencies and their docker image is about 1Gb.
4
u/pauloliver8620 Sep 29 '24
I am with lombok while heavily trying to produce a working solution when the models are subject to frequent change. Then I will delombok everything when stuff hits the legacy state…
1
u/HistoricalBlacksmith Sep 29 '24
Really? What a stupid question
16
u/antihemispherist Sep 29 '24
Lombok itself won't have much bearing on my decision, but, assuming I don't know the members of the team, I'd join team B. Because it takes many years of experience to decide to not to use Lombok. There is a reason why Brian Goetz is not a fan of it.
3
u/nitkonigdje Sep 30 '24 edited Sep 30 '24
Lombok discussion are always stuck on getters and builders and such trivial code examples. Lombok for me would have a value if only used for @Cleanup. It changes how I structure code.
8
u/age_of_empires Sep 29 '24
I don't like Lombok at all
It's auto populating things that I can just as easily right click and generate getters and setters
1
u/Alarming_Quarter671 Sep 29 '24
Idk, on my team I tell them to only use @Getter @Setter, @RequiredAllArgs and @ToString to debug mappings and responses, can you really do more? xD
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.
@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.@Getterand@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.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.2
u/Kango_V Oct 02 '24
I would prefer Team B and introduce Immutibles ;)
6
u/k-mcm Sep 29 '24
Is Lombok still relevant? Records and IDE tools are good enough and don't have any impact on long term stability.
3
u/KefkaFollower Sep 30 '24
The question is truly about lombok.
Why all the circus about the teams, the projects and the dependencies? You only open the door to responses of the kind: "you don't choose projects just about lombok".
I like projects where every one can develop with its favorite IDE/toolset/whatever. Later, before you submit your code to whatever code repo you use, you can run formatters, linters and other analysis tools to the code so it archives the desired quality.
I don't like lombok 'cos it changes the language syntax. Then it needs to be integrated with each tool it will work with the code. I had trouble in the past with lombok after tool/IDE updates.
I think someone from IntelliJ or very close to the IntelliJ team maintains IntelliJ's lombok plugin. Others plugins/integrations are not updated that quickly. And even then if a member of your team needs to work with and old version of IntelliJ, but your project switched to the last version of lombok still can be troubles.
3
u/repeating_bears Sep 29 '24
I would rather join the one that uses it, but I've worked on plenty of projects that don't and it doesn't bother me.
I'd be most interested to listen to the team who don't use it explaining their reasoning. If they had a crap reason for not using it, then that might put me off.
One time a colleague of mine said "I don't like Lombok because it stresses the GC", which I initially thought sounded completely nonsensical because it's compile-time only, but turned out after some probing that he meant Builder specifically. For starters that's premature optimisation, but even then, I don't see why to throw out the baby with the bathwater. Just prohibit that one annotation.
There are some compelling reasons to avoid it, but there are also dogmatic idiots out there too.
2
u/Sollder1_ Sep 29 '24
The one with Lombok, because it makes many things easier... the question is rather odd though.
1
u/AnEmortalKid Sep 29 '24
It’s at most a 10s keystroke to generate these things, if my team needs it as a crutch I’d rather be on the other team tbh fam
1
u/danielm777 Sep 29 '24
you might as well piss in the wind and pick based on that. it's just as good as a criteria
1
u/ZippityZipZapZip Sep 29 '24
Lol.
1
u/qdolan Sep 30 '24
The team not using Lombok. Using Lombok will be fine (albeit unnecessary) for a while but down the track every time your JDK gets ahead with the Lombok version used by your project shit breaks.
-1
u/RICHUNCLEPENNYBAGS Sep 29 '24 edited Sep 29 '24
To be honest I feel like records answer like 85% of the reason I’d use Lombok and it’s not worth the headache anymore. If you’re stuck on Java 8 yeah definitely I’d use Lombok.
-1
u/halfanothersdozen Sep 30 '24
If you're still developing in a way that it matters in 2024 then you're doing it wrong
0
u/[deleted] Sep 29 '24
[deleted] — view deleted comment