News for hackers. Stuff that matters.
Re:New Features in Java 14 by lmm on Tuesday March 03, 2020 @09:33PM (#22480739)
You can use named parameters if you're worried:

  val emily1 = Person(firstName="Emily", lastName="Maness", age=25)
Scala's approach to constructors is a good example of convention over configuration; in Java 99.9% of classes have a constructor like:

    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
which is just ceremonial boilerplate that obscures the actual logic of what the class is doing (an IDE can generate the constructor for you, but the person maintaining your code still has to take the time to comprehend it). You can do the more complicated things in cases where you need to, but it's important to keep the simple case simple.
Re:New Features in Java 14 by nine_k on Tuesday March 03, 2020 @09:42PM (#22480771)
Lombok solves this for Java.
Re:New Features in Java 14 by lmm on Tuesday March 03, 2020 @11:42PM (#22481262)
Using Lombok ends up being just as much effort as using a different JVM language, and the rewards are smaller.
Re:New Features in Java 14 by nine_k on Wednesday March 04, 2020 @12:52AM (#22481509)
The learning curve is way less steep, and you can introduce it into an existing project with zero impedance mismatch.
Re:New Features in Java 14 by neuronic on Wednesday March 04, 2020 @04:14AM (#22482250)
Yes, but in teams where there is no hope of switching to another JVM language like Kotlin, Lombok can reduce boilerplate by enormous amounts.

It's a compromise.

Re:New Features in Java 14 by nickik on Wednesday March 04, 2020 @07:39AM (#22483206)
Lombok is really not that complex and it not close to using a different language.
Re:New Features in Java 14 by Vax45 on Tuesday March 03, 2020 @10:26PM (#22480958)
I would try out Immutables before Lombok. It generates code using the standard annotation processor instead of modifying OpenJDK's AST tree.