Follow Java naming conventions strictly: PascalCase for classes, camelCase for methods and variables, UPPERSNAKECASE for constants. These conventions are universally expected in Java projects and enforced by tools like Checkstyle and SonarQube. Immutability & Error Handling Prefer immutability — use final fields, Java Records (Java 16+) for data carriers, and immutable collections (List.of(), Map.of()). Catch specific exceptions instead of Exception and always preserve the original cause. Use Optional instead of returning null to make absence explicit. Modern Java Leverage modern Java features: Records for DTOs, sealed classes for restricted hierarchies, pattern matching in switch (Java 21+), and the Stream API for declarative data processing. Always run the latest LTS version in…
Key Takeaways
PascalCase for classes, camelCase for methods, UPPERSNAKE for constants.
Prefer immutability — use final fields and Java Records for DTOs.
Catch specific exceptions and always preserve the original cause.
Use Optional instead of returning null from methods.