What I’ve Learned This Week (2018-11-18)

  1. The Lombok @Data annotation can massively cut down the bloat of writing getters, setters, equals, toString, hashCode and constructor methods for your Java DTOs. It’s fairly configurable so will allow you to roll your own methods when needed, or skip getters and setters for fields which shouldn’t be exposed to the outside world.
  2. Log4J prefers .xml config files over .properties ones. This isn’t a big deal, until you include a dependency that has a log4j.xml file and suddenly your own log4j.properties gets ignored. Fortunately it’s possible to use system properties to drag log4j away from the lure of the third-party xml file.
  3. PHP was originally conceived a lightweight templating system over the top of C code. Even its founder thought the idea of writing business logic in a loosely-typed language was nuts. PHP creator Rasmus Lerdorf discusses the history of PHP and how PHP7’s massive performance improvements can save the planet in this video from the WeAreDevelopers Conference 2017. I’ll have to look more into FDO (feedback-directed optimisation) as it sounds like a useful tool for the sort of projects I typically work on.
  4. Java has moved to a six-month release cycle for each major version of Java SE. I was wondering how we moved from Java 7 (the latest and greatest thing when I last worked fulltime on Java apps) to Java 8 (which I’m currently getting to grips with) to suddenly talking about Java 12! It seems like a rather semantic change – the major number will be increased every six months instead of having update releases roughly every six months, while one release every three years will be designated as an LTS release.
  5. Speaking of Java 12, multi-line Strings are about to get awesome thanks to the addition of a new syntax using `` to encapsulate “raw” multi-line strings. Probably not that useful for production code (maybe for Exception messages I guess?) but could come in handy for unit tests.