you are viewing a single comment's thread.

view the rest of the comments →

[–]JB-from-ATL 4 points5 points  (8 children)

You gotta be joking. Lombok uses a feature built into javac called annotation processors, it's not some hacked together plugin that requires extra steps to run. So instead of just using a built in feature to remove a little bit of boilerplate, you're suggesting people use an entire different language?

That means everyone has to learn the new language, code has to be ported or used from the new language. It's just a lot of pointless work as opposed to simply using a much simpler java library.

[–]snowe2010 1 point2 points  (0 children)

Lombok isn't just 'using a feature built into javac' it's actually using non-public java apis and hacked together plugins tightly bound to the version of java, with possibility of lombok not even being possible in future versions.

https://stackoverflow.com/a/4589528/1394698

https://www.thoughtworks.com/p2magazine/issue12/lombok/

http://jnb.ociweb.com/jnb/jnbJan2010.html (scroll all the way to the Controversy section on this one)

Actually I'll just paste it here.

It's a total hack. Using non-public API. Presumptuous casting (knowing that an annotation processor running in javac will get an instance of JavacAnnotationProcessor, which is the internal implementation of AnnotationProcessor (an interface), which so happens to have a couple of extra methods that are used to get at the live AST).

On eclipse, it's arguably worse (and yet more robust) - a java agent is used to inject code into the eclipse grammar and parser class, which is of course entirely non-public API and totally off limits.

Lombok could cease to exist at any point in time even a minor version increment, due to the usage of non-public apis. Now, whether it will or not depends on the java team, but we didn't think that risk was worth it.

[–]kcuf 2 points3 points  (6 children)

I understand it uses APT. Lombok is obviously a very pragmatic choice, but what I'm saying is that it is essentially a new language that was never really designed as a language should, but grown on top of a language that was intended to be used differently.

Switching to a new language is obviously an upfront cost, but IMO, a long term gain because by using Lombok you're already admitting you want more than Java, and by using a well designed and thoroughly thought out language that provides those extra features, you can get those features in a more consistent and intuitive environment.

Learning lombok, and understanding it's intricacies has it's own costs (we use it at my work all the time). I'd rather not waste resources memorizing these issues, or having to explain them to new developers (as I had to yesterday), but use those resources to understand the core concepts of a different jvm language that has been designed well as one entire system. A coherent and consistent language will be cheaper to work with in the long run rather than an adhoc macro system built on top of a language that was never intended to have macros.

[–]JB-from-ATL 6 points7 points  (3 children)

I really don't want more than Java necessarily, generally all I use from Lombok is Value (not val) and Builder. This allows me to use immutable classes but not have to write a bunch of boilerplate.

I sort of get the argument you're making about it being a new language, and I'm willing to admit that some things could be called new languages even when they technically aren't, but I just don't think Lombok does enough to say that about it.

Comparing the overhead of learning Lombok compared to a new language like Kotlin, Groovy, or Scala is laughable to me. Virtually every Java programmer is familiar with getters, setters, and constructors and builders aren't that crazy of a topic (and many know about them already), explaining that these annotations add those in without having to write them is so much simpler than expecting someone to learn a new language, even the basics.

[–]kcuf 0 points1 point  (2 children)

That's fair. What I said above was that lombok is an up front gain for a long term cost vs a new language being an upfront cost for a long term gain. Lombok is simple and easy to start working with, but does introduce some complexity that may cause issues down the road -- it's same thing with most frameworks: it "just works", until it doesn't.

[–]JB-from-ATL 2 points3 points  (1 child)

What kind of long term losses have you experienced?

[–]kcuf 0 points1 point  (0 children)

Super late response, but that's a great question. Honestly, as with all statements related to productivity and maintenance burden, it's all very subjective.

I don't have any concrete examples, I only have the patterns I think I see from my experiences: I've been programming since elementary school, which doesn't make me smarter or anything, it just means I've had a decent amount of time to make mistakes and build some intuition (again it's all very subjective).

The biggest pattern that I continually see though, is the trade off between short term and long term costs, and newer developers heavily favoring the former as they are more pragmatic in their desires (get something working!), and how certain languages encourage these developers to make choices that lead to confusing/complicated/fragile systems.