Tag: java

Call by Value vs. Call by Reference

Defines call by value and call by reference from the Dragon Book and Strachey, then compares how Java, Kotlin, JavaScript, C, C++, C#, Python, Go, Rust, and Ada pass arguments to functions.

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

Documenting and Verifying Thread Safety: Javadoc, Annotations, Static Analysis, and ArchUnit

How to state thread safety in Javadoc, and how to use annotations, static analysis tools, and ArchUnit tests to keep code that is unsafe under multiple threads from being deployed.

Continue Reading

MySQL JDBC Configuration for High-Performance Batch Jobs

Connector/J options that matter for batch workloads on MySQL - useServerPrepStmts, cachePrepStmts, rewriteBatchedStatements, result-set streaming with Integer.MIN_VALUE, and server-side cursors with useCursorFetch - with notes on how each interacts with Spring Batch's JdbcCursorItemReader.

Continue Reading

Running External Processes from Java: JDK 25 on Linux 6.x

What to get right when launching external processes from Java on JDK 25 and Linux 6.x: draining stdout and stderr, closing stdin, timeouts, termination policy, and cleaning up descendants with process groups or cgroups. Compares zt-exec and Apache Commons Exec, and explains the default posix_spawn launch mechanism, the cost of FORK on large heaps, and the removal of VFORK.

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