Learn modern Java style conventions to replace outdated boilerplate-heavy patterns like JavaBeans with getters and setters.
Discover vetted third-party Java libraries that fill gaps in the standard library for JSON, dates, logging, and utilities.
Improve Java project setup by learning recommended build tools, editors, and code quality analysis tools.
Use as an onboarding reference to bring team members up to speed on cleaner Java practices and tooling choices.
No code to run. Read the guide directly on GitHub. Apply recommendations incrementally to any existing Java project.
Better Java is a written guide for people who already know Java and want to write it in a cleaner, more modern style. It does not contain a library or runnable code. It is a long article organized into sections covering coding style, deployment choices, useful libraries, and development tools. The style section argues against older Java habits that produce a lot of repetitive boilerplate. It recommends treating data-holding classes more like simple structs rather than the traditional JavaBean pattern with getters and setters for every field. It covers patterns like the Builder pattern for constructing complex objects, using immutable data structures so that values cannot be accidentally changed after creation, and avoiding null values by using the Optional type introduced in Java 8. The section also touches on when to use checked exceptions versus runtime exceptions and how to structure dependency injection, which is a way of writing code that is easier to test. The libraries section lists third-party packages that fill gaps in the Java standard library. These include Guava for common data structure utilities, Gson for converting Java objects to and from JSON, Joda-Time for working with dates and times before Java 8's built-in time library existed, Lombok for generating repetitive code automatically, and SLF4J for logging. Testing libraries covered include JUnit for writing unit tests and AssertJ for writing clearer test assertions. The deployment section covers build tools, specifically Maven, and how to manage dependencies and packaging. The tools section recommends IntelliJ IDEA as an editor, lists code quality analysis tools, and mentions a memory analyzer for diagnosing performance problems. The guide ends with a short list of books, podcasts, and videos for going deeper. It was originally posted as a blog article by the author and is available translated into Chinese. The full README is longer than what was shown.
← cxxr on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.