#16 Getting Started with Quarkus
Custom Jackson Annotations. Java Almanac. The History of the URL. SQL Window Functions Cheat Sheet
Welcome to the sixteenth Dukesletter edition!
The Law of Unintended Consequences
When we try to make a single change within a complex system, we often end up causing unintended consequences— Robert K. Merton
New Project Leyden is landing into the OpenJDK. You can get more information about it in this article.
JDK 15 is now in Rampdown Phase One.
In the latest edition, we reviewed Files API, but I missed a recent article from Marco Behler explaining the same concepts with better examples: Java File IO: Modern APIs to Create, Read, Write & More.
Getting Started with Quarkus
In recent years the JVM stack has experienced a revamping with the appearance of new frameworks like Micronaut or Quarkus.
Both tools inherit the best of Spring, and although technically everyone can do the same, they are focused on:
Developers productivity
Cloud support
Native compilation
Both frameworks change the paradigm by performing much of the magic in compile-time instead of runtime.
Quarkus is supported by RedHat, and have just released version 1.5. The project started later than Micronaut, but it has much more resources and has reached a large number of integrations with other technologies. You have a complete list in their online initializer.
As a first contact, you can start reading “Getting Started with Quarkus” by Roberto Cortez. For more information and a live demo you can continue with this video from the latest Devoxx:
Custom Jackson Annotations
If you follow Clean Architecture and Hexagonal Architecture good practices, you know that you can not add infrastructure code to your business logic or domain.
But ORMs and data mappers make it very easy to skip the norm, and invite you to add their annotations to your entities, making them dependent on the framework.
Jackson, an omnipresent framework for any kind of serialization, provides a mechanism for not depending on him: custom annotations.
In “Zero-dependency Jackson entities with custom annotations”, Sergei Egorov explains how to avoid dependencies to Jackson in your main artifact.
In the article, custom annotations are used to deserialize entities in Tests without adding Jackson dependencies to the deployable artifact, with the tradeoff of soiling your entities with some strange (but own) annotations. The method has some boilerplate code, but it's the price to be paid.
A pure practitioner of Hexagonal Architecture could discard this solution, but it is an intermediate solution to getting your code populated with all kinds of dependencies.
Java Almanac
Now that the JDK team releases a new version every 6 months, we can not remember which feature had each release, and how APIs and documentation are changing.
To simplify it, Marc R. Hoffmann has developed a complete site that collects all the information of each release: Java Almanac.
For each version, you have links for: Javadoc, Language Specification, Virtual Machine Specification, and Release notes
And what is more interesting, a matrix to compare changes between version:
with the detail of API changes:
The History of the URL
Many of the things we do and see every day were not created with complex analysis, thinking that they would be used by millions of humans. They arose from the particular occurrence of a person in a situation of necessity.
Why is the URL like this? Why do we use //
, :
or #
chars?
URLs were never intended to be what they’ve become: an arcane way for a user to identify a site on the Web.
- Dale Dougherty 1996
Cloudflare team has published “The History of the URL”, explaining the history of basic concepts of Internet: DNS, TLD, Punycode, the URL protocol, query params, or Input tag …
SQL Window Functions Cheat Sheet
SQL is probably one of the most powerful but most underrated languages in the development world.
One of the most advanced features are the window functions, and I always have problems with their syntax, visualizing how the window is applied, and how to aggregate their information.
Windows Functions are supported by main database engines: in 2018 MySQL 8 added it, but has been available since 1998 in Oracle or 2009 in PostgreSQL.
To understand and remember how it works, LearnSQL has published a Cheat Sheet with a lot of diagrams and explanations. Bookmark it, someday you will need it!
A web version and links to multiple formats is available here.