Tag: code-review

Java Autoboxing: How It Compiles and How the Integer Cache Works

How javac compiles autoboxing into Integer.valueOf() and intValue() calls, checked in JDK 25 bytecode, plus the -128 to 127 IntegerCache, JLS 5.1.7, -XX:AutoBoxCacheMax, boxing costs in loops, and what changed from JDK 5 to JDK 25.

Continue Reading

How Java Optimizes String Concatenation

How javac and the JDK runtime optimize String concatenation with + across versions: StringBuffer in JDK 1.4, StringBuilder in JDK 5, invokedynamic in JDK 9, and hidden classes in JDK 24, with bytecode checked on JDK 25.

Continue Reading

VO vs. DTO: Definitions and the History of Conflating the Terms

Calling a getter/setter data carrier a VO (Value Object) causes confusion. A Value Object is a classification by meaning and value equality, while a DTO is a classification by its role of transferring data. This article walks through both definitions, how Core J2EE Patterns spread the conflation in the Java/J2EE world, and a naming convention that keeps roles visible.

Continue Reading

IEEE 754 Floating-Point Errors and Alternatives in Java

Why storing 0.1 in a Java double causes a rounding error in the 52-bit IEEE 754 fraction, two failures it caused (NEIS grading and the Patriot missile), and how to choose between BigDecimal, integer minor units, and libraries such as Java Money.

Continue Reading