Java in the Small

Using Java “in the small”

  • Many are surprised how far Java has come for scripting: single-file source execution (java file.java), preview implicit classes/top-level main, automatic imports (e.g., IO.println), and JShell.
  • Newer features like var, record, local records, and switch expressions make short programs less clunky and more expressive.
  • Some use Java 21+ for Advent of Code and quick utilities and report it feels much nicer than “old Java”.
  • Others argue that for true “one-off” CLI scripts, Java remains heavier than ideal, especially once dependencies or build tools enter the picture.

Comparisons to Other Languages for Scripting

  • Python and Go are still widely seen as better fits for quick scripts: less ceremony, easier deployment (including static binaries in Go).
  • Several note that C#/.NET (with top-level statements, LINQ, scripting tools, notebooks) is ahead of Java in “small” productivity.
  • Kotlin, Scala (scala-cli, ammonite), Groovy, Clojure/babashka, JRuby, and Kotlin scripts are highlighted as JVM-based options that feel more “script-like” while reusing Java libraries.
  • Deno, Node.js, PHP, Ruby, and F#/dotnet-script are cited as alternative scripting ecosystems.

Ecosystem, Frameworks, and Tooling

  • Strong split on frameworks: some praise Spring Boot and Spring Data as massive productivity multipliers; others describe legacy Spring/Hibernate codebases as opaque, slow, and hard to reason about.
  • Debate over frameworks vs libraries: frameworks invert control and boost CRUD productivity but can hide complexity and create tight coupling.
  • Many dislike Maven/Gradle complexity for small tasks; others point to tools like JBang, coursier, scala-cli, or simple CLASSPATH usage to keep things lightweight.

Language Design, Exceptions, and Types

  • Several see Java as excellent for large, long-lived projects: stable evolution, strong tooling, runtime introspection, and backward compatibility.
  • Others criticize checked exceptions and verbosity; comparisons are made to Rust-style ? and other languages’ more ergonomic checked-error syntax.
  • Discussion of generics, type inference, and upcoming features (value objects/Valhalla, improved nullability) shows recognition that Java is converging toward more modern type systems, though some still prefer Kotlin/C#.

Teaching and First-Language Debate

  • Simplified main is seen by some as a big win for beginners, reducing confusing boilerplate; others think the old public static void main was a useful early lesson in Java’s model.
  • Broader disagreement over whether Java is a good first language at all versus starting with a REPL-driven, less ceremonious language (Python, BASIC-like environments).

Performance, Memory, and Deployment

  • Consensus that modern HotSpot is very fast and GC is highly advanced, but disagreement over memory footprint and startup time relative to Go/Rust/Zig.
  • Some organizations remain on Java 8/11 due to upgrade risk, effort, or lack of perceived benefit, despite clear performance and GC gains in newer JDKs.
  • Native images (GraalVM) and better container tuning are suggested to mitigate startup and memory concerns for microservices and functions.