Live data from Hacker News

Lombok makes Java cool again

bytes.grubhub.com

131–140 of 239 posts

Re: Lombok makes Java cool again

#131

Reading this just reminds me of all the terrible things about Java. The lack of reasonable default string representations, comparison and hashing methods, etc. are all glaring mistakes in the language design that have wasted huge amounts of time for millions of programmers. It's as though Java programmers are so deep in the grips of Stockholm Syndrome that ordinary, sensible behaviour seems amazing and "cool". This i…

You have to look at it from a time when C++ was the mainstream for large scale projects. Java is certainly a god-sent gift to software salaryman all over the world.

Re: Lombok makes Java cool again

#132
Annotation-based programming might seem cool now, but wait a few years.

Magic always seems cool when you add it to a project - hey, look - I don't have to do anymore.

Then time goes on, and you (or your successor) opens up the project to track down a bug. Only there's no logical flow - things just seem to happen as if by magic.

Lombok strikes me as magic in these ways.

I actually had to go to the project home page to figure out what problem it solves:

https://projectlombok.org

The examples refer to a specific kind of boilerplate, namely the kind that comes from treating classes a dumb bags of properties. Getters directly returning private fields. toString methods, etc.

An alternative approach to Lombok would be to think about how the project ended up with so many dumb data classes. How could the project be refactored to eliminate them, for example?

Doing so would avoid the need for magic and produce a code base in which effect followed cause.

Re: Lombok makes Java cool again

#133

It’s ok to let languages die; we’re just barely scraping out of the infancy of programming. Languages like Java and C++ which have carried us a long way need to evolve into new and better languages that incorporate lessons learned and the next wave of research. We also know from Google’s paper on software practices that software naturally gets rewritten over time, at a cadence that makes it acceptable to switch langu…

I see the opposite. I see an industry all too willing to throw away years of hard earned knowledge, experience and purpose built tools in order to chase the shiny tools the popular kids are using.

New tooling often follows a commom cycle of being light weight because they ditched the stuff that looked unecessary. Then slowly a whole ecosystem of plugins and libraries springs up to rebuild the missing tools. Like the bottom bracket tool in a bicycle tool box. I have never used one, but when I need one no other tool would work.

I do truly believe that there is mastery in advanced, long lived tooling and efficiency may not lie with a new language but in truly understanding a comprehensive set of ordinary tools.

Languages also tend to be just the building blocks for the real tools, which are the frameworks and libraries built with them. So I hesitate to throw away my hard earned knowledge only to re-learn another artisan MVC framework written in a prettier language.

I concede that the parade must go on though, and ultimately I have to pay the bills. If precompiled serverside React is where the money is then... so be it.

Re: Lombok makes Java cool again

#134

It’s ok to let languages die; we’re just barely scraping out of the infancy of programming. Languages like Java and C++ which have carried us a long way need to evolve into new and better languages that incorporate lessons learned and the next wave of research. We also know from Google’s paper on software practices that software naturally gets rewritten over time, at a cadence that makes it acceptable to switch langu…

On the other hand I am impressed at how open industry has been to new languages since 2010. At the risk of dating myself slightly in the 2000 - 2006 era proposing a completely new language to solve a business problem was a much more radical idea. This was the era where you could get a lot of street cred and tech envy from hackers by just picking a non mainstream language (Examples - Viaweb using scheme, Naughty dog using lisp, Jane Street using Ocaml, ITA software using lisp). On an optimistic note I think there has never been a better time to ship new tech stacks, users are open to change and companies are fairly open to trying new ideas out.

Re: Lombok makes Java cool again

#135
post #132

Annotation-based programming might seem cool now, but wait a few years. Magic always seems cool when you add it to a project - hey, look - I don't have to do anymore. Then time goes on, and you (or your successor) opens up the project to track down a bug. Only there's no logical flow - things just seem to happen as if by magic. Lombok strikes me as magic in these ways. I actually had to go to the project home page to…

I liked to refer to the genre as MOP -- Magic Oriented Programming. Every ecosystem I've seen go down that route ends up bailing out. A good example of this would be Apple's Cocoa Bindings [1] on macOS that were killed with fire when the iOS APIs were defined, and KVO [2] which is flat out rejected at every company I've ever worked.

On the other hand, when built into the language, this kind of explicit but automatic code generation can be awesome (as in Rust's #[derive()] traits [3]) but I think the difference there is the compiler/language vendor agree to support it indefinitely.

[1] https://developer.apple.com/library/archive/documentation/Co...

[2] https://developer.apple.com/library/archive/documentation/Co...

[3] https://doc.rust-lang.org/rust-by-example/trait/derive.html

Re: Lombok makes Java cool again

#136
post #132

Annotation-based programming might seem cool now, but wait a few years. Magic always seems cool when you add it to a project - hey, look - I don't have to do anymore. Then time goes on, and you (or your successor) opens up the project to track down a bug. Only there's no logical flow - things just seem to happen as if by magic. Lombok strikes me as magic in these ways. I actually had to go to the project home page to…

Annotation based magic has always felt like a hack to me. Surely there is a way to solve these problems within the constraints of the language. It adds a layer of ambiguity to what code any class actually contains at run time and that is never ideal.

Re: Lombok makes Java cool again

#137

Reading this just reminds me of all the terrible things about Java. The lack of reasonable default string representations, comparison and hashing methods, etc. are all glaring mistakes in the language design that have wasted huge amounts of time for millions of programmers. It's as though Java programmers are so deep in the grips of Stockholm Syndrome that ordinary, sensible behaviour seems amazing and "cool". This i…

Which design patterns are you thinking of and which languages had them? The original gang of four Design Patterns book is filled with C++ examples, most likely because almost nobody was using Java in 1995 outside of a few people at Sun. More generally comparison and hashing methods seem like small potatoes compared to locking primitives, portability, and a large, well-documented class library that have made Java idea…

C++ circa 1995 was a lot more like Java with manual memory management, really. Templates were a rare sight, STL was not yet a thing, and it was still considered an impure OO language rather than multi-paradigm.

Re: Lombok makes Java cool again

#138

i also wanna give a shoutout to https://immutables.github.io/ over Lombok. No AST magic, and even optimized Jackson/GSON code.

This, a million times.

In my professional bubble Lombok is completely gone. I'll go as far and say that modern Java does not use Lombok. Smaller, focused libraries like Immutables or AutoValue, solve the problem of boilerplate for data classes.

Lombok tries to do too much across many concerns, in a fairly opaque way, and makes the code and tooling around it more magic than it needs to be.

Skip Lombok. Modern Java is better off without it...

Re: Lombok makes Java cool again

#139
post #132

Annotation-based programming might seem cool now, but wait a few years. Magic always seems cool when you add it to a project - hey, look - I don't have to do anymore. Then time goes on, and you (or your successor) opens up the project to track down a bug. Only there's no logical flow - things just seem to happen as if by magic. Lombok strikes me as magic in these ways. I actually had to go to the project home page to…

> Annotation-based programming might seem cool now, but wait a few years.

I even have this experience on my own projects and with much shorter span than a year.

When I go back to a code base I worked just 3-4 month ago -- I have very hard time following Dagger injections. Braking one of the Dagger providers (I use dagger 2) creates 10s and 10s of compilation errors.

So I have been slowly removing dagger from my code bases. As I just cannot follow it, I do not know it well enough either.

I stopped using Lombok for same reason, although I found Lombok is much more intuitive.

I thought about going to Kotlin, but it was just too much of cognitive overload (in this particular instance both for backend and android UI).

Instead, I am finding the use of rxjava and friends a lot more intuitive and helpful for the type of things I need help with (interconnecting components on different threads, with different lifecycle and data structure semantics, with lots of asynchronous behavior options).

And the same rx- library is available to many other languages, therefore, the skill I am building up is sort of 'cross-language'.

Re: Lombok makes Java cool again

#140
post #82

Earlier quoted context omitted.

I can read Scala fine but I'd like fast compilation and good IDE support.

The IDE support is pretty good these days, as least in IntelliJ.

Apart the fact that I would disagree on intellij support, what about the other ides? Eclipse? Visual studio (not code)?
Post reply on HN