1

Lombok looks great! The dream of getting rid of boilerplate!

What are your experiences with it?

Comments
  • 0
    @Data and @Value are my favourites
  • 2
    it was my favourite until I figured out @Builder was adding @ToString automatically. This could potentially leak information in logs.
  • 1
    It's essential for modern Java. Data, requiredargsconstructor, noargsconstructor, equalsandhashcode, value, getter/setter, etc etc. Won't code Java without it anymore.
  • 1
    @minisha exclusion would help, but it would litter the code if there are many
  • 0
    @SortOfTested Yeah, my code is littered with boilerplate such as Logger logger = Logger.getLogger(), LogHelper classes and just overall log noise and I've been meaning to get rid of this cross-cutting noise cluttering my applications. My first step was to use Spring AOP, which logs when a method is called, but it doesn't log where I want it to log.. inside a method, on specific lines..
  • 1
    RequiredArgsConstructor is extremely useful with Spring. Just declare your fields final and AutoWiring will do the rest. This will pay out when writing unit tests for this Spring component.
  • 2
  • 3
    @matste I'm not the manager of the company.
  • 0
    @SortOfTested If you use it commercially, do you have to incorporate an MIT copyright notice in each class?
  • 0
    @matste how about you shut the fuck up
  • 1
    @CaptainRant most of the apps we build are SaaS now. Unless you distribute it to the users, that's not a necessity. Even then, you could choose to relicense your app and forgo that
  • 0
    @PublicByte
    I would, but the jvm is garbage and I only write Java when I'm paid to. I'll just keep lombok.
  • 2
    Lombok is fantastic. A must for all new Java projects. The fact it so happens to be a compiler "hack" is kind of besides the point. It works damn well.

    Those saying "har har just stop using Java" are, IMHO, missing the point. For personal projects, sure, I'll use Kotlin these days near universally. I'm not wedded to Java, or any other language, whatsoever. I'll use what's best for the job.

    But the fact of the matter is, like it or not, for a lot of businesses Java *is* still the language for the job these days. Good luck persuading your boss to switch all existing Java projects to Kotlin (or heck even start new projects in Kotlin) when Java devs are a dime a dozen and Kotlin devs are... much rarer, shall we say. Lombok offers a nice way to remove a heck of a lot of Java boilerplate while still staying with Java. Sure, it has its quirks and you need to be aware of what exactly you're using it for, same as any framework - but all in all it gets a big thumbs up from me.
  • 0
    Hey, I didn’t say to move old projects to Kotlin.

    Lombok is fantastic. Total agreement here.

    I think your hypothetical boss of a new JVM project overestimates the cost of converting a Java dev into a Kotlin dev. This is not like a conversion to Scala or Closure.
Add Comment