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.

  • lysdexic@programming.dev
    link
    fedilink
    English
    arrow-up
    9
    ·
    8 months ago

    I feel like so much effort is spent trying to solve problems that just aren’t problems.

    I don’t think your belief has any merit.

    The popularity of tools such as Lombok and JVM languages such as Kotlin demonstrate the pressing need to eliminate the need for boilerplate code in Java to do basic things.

    It matters nothing if an IDE can generate all the getters and setters you wish. The problem is the need to generate all those getters and setters for a very mundane and recurrent usecase. All this boilerplate code adds to the cognitive load and maintenance needs of all projects, and contribute to the introduction of bugs.

    I can count on the fingers of one hand the number of times I’ve actually needed to write a hash or equals method.

    That’s fine. Other people write code and are able to assess their own needs, and the verdict is that not having to write boilerplate code beats having to write it.

    If your personal experience was shared by many, Lombok or Kotlin would not be popular.