Welcome to the first Dukesletter edition!
Java ecosystem is on fire and we are getting a lot of improvements, tools, and libraries day by day.
Dukesletter will try to summarize each week the news of the ecosystem and introduce articles, tutorials (new and old) on relevant and interesting topics of the platform.
1.- What's new at JDK 14: Records
Following the schedule, JDK 14 announced the First Release Candidate, maintaining the final release on March 17.
This version brings a lot of improvements that will be introduced in different newsletters, but one of my favorite features is JEP 359: Records which is still in preview phase.
You can get more info reading:
The introduction in the associated JEP 359.
The Complete specification from the Java Language Specification site.
An article by Brian Goetz in InfoQ.
A deep analysis of generated bytecode to understand what the code would look like if you wrote the equivalent class by hand.
Records will not fix Java Serialization horrible mistake, but they are not going to fall again in the same error. Heinz Kabutz explains in his latest JavaSpecialists' Newsletter how Serialization is implemented in Records.
You mustn't confuse Records with Value Objects. They are similar but have different objectives. You can read more about it in this post written by Brian Goetz.
Personal thoughts: Are Records just syntactic sugar? Why Java Language is not decoupled from Java Runtime? would it be hard to add it to Java 8 compiler or generate Java 8 bytecode using Records syntax?
2.- Dependency management
Do you know what a scope is in Maven or Gradle? how each tool behaves in each case?
Dependency management is a major issue and it is necessary to know how each tool behaves when you add a dependency to your projects.
In the following article, you can learn how each tool manages the dependencies: “Maven Scopes and Gradle Configurations Explained”.
Gradle seems to be much powerful in managing the dependencies. As library creator, Gradle allows us to explicitly specify which dependencies we want to expose, reducing dependency pollution to the consumers of our library.
3.- JShell
Until version 9, Java did not have a REPL (Read-Evaluate-Print-Loop), a powerful tool very common in other programming languages.
The following complementary articles give us some tips and advice so that we can start using it:
4.- Bloom filter
Everyone knows what a map, a list or a tree is, but there are many data structures that deserve to be studied. The Bloom filter is a compact data structure based on probabilistics, which is only able to answer "No" or "Maybe".
The following video explains graphically how it works:
Which other non-traditional data structures do you use in your daily life?