Advances in the java programming language, version 16 and newer, slashed a million lines of code from my codebase. Maintaining my programs became easier overnight, due to this 1 secret trick: Records. 
Unfortunately version 16 was not LTS, so I had to wait until this year’s release of version 21, which is LTS. 
 Go read the linked article. It explains Java Records in a very approachable manner.

  • Luvon@beehaw.org
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    1 year ago

    What major Java supporting ide doesn’t support Lombok? Even vs code with Java extensions supports it.

    And the third party dependency is a weak argument. You will have dependencies in any major application. Lombok is a well tested dependency at least.

    Nothing against records, working on using them more but they don’t always play nice with hibernate.

    But I guess that’s another terrible third party dependency we should all avoid.

    • lysdexic@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 year ago

      What major Java supporting ide doesn’t support Lombok?

      Why would everyone have to onboard a code generator just to be able to use data transfer objects without having to write tons of boilerplate?

      Also, Java records allow the runtime to optimize how these instances are handled.

      • Luvon@beehaw.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        I already tend to have the code generator for various other abilities it offers. Things like annotations for logging, Val, and builders are just very practical and Java doesn’t otherwise have a way to get rid of that boilerplate.

        If I can use a record I will now (especially since we are now on Java 17) but like I said, I haven’t been able to make spring and hibernate play nice with records so far so I’m stuck with classes for some @data things