Saturday, 11 October 2025

Java best practices, for features introduced from Java 9 to Java 25

I've just watched a recording of a presentation by Stephen Colbourne from Devoxx Belgium "The New Java Best Practices by Stephen Colebourne".

Some of them I agreed with, some I am yet to warm to.

  • I haven't made much use of "var" in place of specifying a variable type, so I still find code more readable when the type is specified.
  • I am fully onboard with the best practice about the use of modules, "arguably the biggest change since Java 8".
  • unnamed variables came in Java 22, which might explain why I haven't encountered it so far - as companies tend to stick to long term support (LTS) versions of the language so I only got to Java 21.
  • markdown docs. Check out the Inside Java podcast about this ( https://inside.java/2025/01/21/podcast-034/ )
  • Optional and null - the code style example shows how Optional can flow as more readable

This is not an exhaustive breakdown of what Colbourne covered, so I recommend that you take a look for yourself.


No comments:

Post a Comment

A time for cool heads