Articles on Java

Last updated: 2023/03/08

Top deep-dives on Java

It's probably time to stop recommending Clean Code

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 JPA and Hibernate first-level cache

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.

Why General Inheritance is Flawed and How to Finally Fix it

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.

Disassembling Hello World in Java

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.

100% CPU: My Fault?

"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.

Java Concurrency: Deadlock

Writing Environment-Agnostic Functional Acceptance Tests

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.

Why I rewrote my open source virtual reality server

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.

The difficult problem of managing Java dependencies

Paulo Renato de Athaydes dives into the state of dependency management in Java, demonstrating how different tools work and why.

Hash, displace, and compress: Perfect hashing with Java

Andrei Ciobanu demonstrates implementing a perfect hash function in Java.

Virtual Threads: New Foundations for High-Scale Java Applications

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.

Consolidating the user model

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

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.

Fixing the Next 10,000 Aliasing Bugs

The author of this article looks at a number of common software bugs that are solved by something resembling Rusts' borrow-checker. Is it an ad for Rust? Kind of. Is it still interesting? Yup.
Some highlights:

  • Uses an implementation of a Java array to demonstrate aliasing bug
  • Explores a Solidity bug that lead to $150 million being stolen
  • Presents how these types of bugs can be eliminated

JVM Field Guide: Memory

This article is the first chapter of an attempt to create a guide for running and supporting JVM applications. Sergey Tselovalnikov focuses on memory and how it is handled by the JVM.
Some highlights:

  • The test environment choice for this article is an ubuntu docker image that’s sized to use 2GB of memory
  • Looks at heap and off-heap memory
  • Analysis of garbage collector

Benchmarking Non-shared Locks in Java

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.

Retrofitting null-safety onto Java at Meta

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.
Some highlights:

  • 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

More Evidence for Problems in VM Warmup

Laurence Tratt discusses a paper on the subject of how programming language VMs (Virtual Machines) warm-up, or often don't. The author describes how
Some highlights:

  • VMs are meant to run programs in an interpreter, observe which portions run frequently, then compile those portions into machine code which can be used instead of the interpreter
  • Research shows that the above doesn't really happen
  • According to the data, only 1/10th of the process executions on the JVM reach steady state

Did You Know the Fastest Way of Serializing a Java Field is not Serializing it at All?

Per Minborg dives into the performance of different methods for the serialization of data in Java.

Want to see more in-depth content?

subscribe to my newsletter!

Other Articles