Articles on Java
Last updated: 2022/11/29
Top deep-dives on Java
As humans, most of us are subject to authority bias, which can be described as the natural tendency to follow the leader. But the fact is, authoritative figures aren't always right. In this extensive article, Sam Hughes questions the merit of preaching ALL of the teachings of Clean Code by Robert C. Martin, by picking at some of the "questionable assertions" made.
The Java Persistence API is a Java application programming interface specification that describes the management of relational data in Java. It's basically the built-in Java way of interacting with relational databases. In this article, Vlad Mihalcea lists the possible states for a JPA entity, outlines the Hibernate first-level cache implementation, and explains the transactional-write behind cache strategy.
Uncontrolled inheritance can start to suck a lot because it leads to a convoluted web of dependency. In this explanatory article, Per Minborg discusses when Java classes and methods should be made final and other general good practices for controlling composition in your software.
How does one turn the idea of nothing into something physical? Well Alex, you say in your most pedagogic inner voice, isn't that what 0 is? Well dear reader, it's probably up to the individual, but null is one of the more common methods. Piotr Kołaczkowski's article however, focuses on an alternative to null, the Optional or Maybe type. Piotr specifically focuses on the performance impact of using this type, as opposed to primitives, in both Java and Rust.
Vlad Mihalcea demonstrates how small issues in Java concurrency implementation can lead to big financial problems.
You might think yourself above a simple "Hello world" example written in Java, but do you really understand every single part of the program? In this concise article, Metin Özyıldırım picks apart the titular program, explaining the .class file format, diassembling, interpreting the bytecode, and the Java native interface and system calls.
"You broke something" isn't usually what you want to hear from a system admin. Unless maybe we're talking about a record. In this case, Joseph Mate is not talking about records; instead his article is about how and why a well-intended optimization led to a JDK8 bug that caused 100% CPU utilization.
Modularity is pretty important when it comes to creating prototypes or tests. You want to be able to quickly switch or change things out, depending on evolving circumstances or requirements. Jamie Tanna's article brings to light a technique using class structures for writing modular and adaptable testing suites for services in Java.
Virtual Reality has been growing in popularity over the past couple of years and for good reason; the hardware is becoming more practical and accessible. Unfortunately, the open source space for VR is pretty limited, with big companies vying for control of the space and your data. Josip Almasi describes his privacy (and practicality) based motivations for creating an open source virtual reality server, while also outline some of the resources used and design approach.
Paulo Renato de Athaydes dives into the state of dependency management in Java, demonstrating how different tools work and why.
Andrei Ciobanu demonstrates implementing a perfect hash function in Java.
Brian Goetz presents virtual threads in Java 19. Virtual threads are a lightweight implementation of Java threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications. Brian discusses existing threads, virtual threads, why they're being added, and the limitations of async. Not going to include highlights because there are key takeaways at the start of the article.
Project Valhalla is an experimental OpenJDK project led by Brian Goetz, with the aim of adapting the Java language and runtime to modern hardware. Now that the "primitive classes have taken shape" Brian Goetz has written an article-esque email where he once again explores one of the main objectives of Valhalla, "providing user-programmable classes which could be flat and dense in memory".
Loop fission is usually done by the compiler (although you can use it in your own coding to) to break up big loops into smaller loops, which can then potentially be optimized on their own. In this article, Richard Startin presents two examples where manually fissioning his loops resulted in better performance when using Java's C2 compiler.
Michael Fogus explores the development process for a Lisp as compared to Java.
- Developing with a Lisp feels more like collaborating with the programming language, as opposed to ordering it around
- One of the advantages of developing with a Lisp is being able to interact with your program as it's running
- Lisps encourage continuous development cycles
Locks are a key component in thread programming. In this practical article, Andrey Pechkurov explores several different options for spin locks in Java; specifically focusing on their performance in terms of latency.
Artem Pianykh, Ilya Zorin, and Dmitry Lyubarskiy describe the development of a new static analysis tool called Nullsafe that is used to detect NullPointerException (NPE) errors in Java code.
- The tool is designed to improve the null-safety of Java code by providing tools to express and check nullness invariants
- The tool has been integrated into the core developer workflow and has helped to significantly reduce the overall number of NPE errors and improve developers’ productivity
- Interoperability with legacy code and gradual deployment model were key to Nullsafe’s wide adoption in a multimillion-line codebase
Vadim Filanovsky and Harshad Sane discuss how a microservice was moved to a larger AWS instance size in order to increase performance, but the results were far from the desired goal. Through further investigation, it was discovered that there was a strange pattern in the CPU and latency metrics between nodes.
- A larger instance type didn't solve the problem
- Flame graphs can be used to compare CPU performance
- The root cause was “false sharing,” where 2 independent variables share a cache line
Per Minborg dives into the performance of different methods for the serialization of data in Java.