Skip to content

Java

General

Code style

  • Formatting
  • Following the Google Java Style Guide
  • Any deviations??
  • (Anti-)patterns
  • TODO (requires reference & motivation) [Guideline]
    • Exception handling
      • In relation to closeable objects
    • Use of interfaces
    • Re-assigning variables (i.e. not final)
    • Mutable collections
    • Home brewing common but error prone algorithms
      • instead use library, typically guava
      • examples: parsing (csv), string manipulations, IO pipelines, ...
    • ...
  • Design considerations for applications and services
  • OOP principles

Frameworks & libraries

Guideline: for each of the categories in the table below, investigate the applicability of the library listed in the respective ‘guideline’ column before considering alternatives or implementing your own utilities.

Category

Guideline 

Remarks

General utility:
Collections, Strings, IO, ..

Guava
and/or
Apache Commons

Logging facade

SLF4J

Log binding

logback

Log4j acceptable but considered legacy; migration to logback recommended

CLI options

Apache Commons CLI

Dependency injection

Spring IoC

Use general Java annotation (e.g. @javax.inject.Inject)

Web application (server side)

Apache Wicket

Spring (WebMVC, thymeleaf)

Web service

Dropwizard

Spring (WebMVC / WebFlux)

Testing

JUnit

Mocking

Mockito

XML testing

XMLUnit

Documentation

  • Javadoc
  • [Which guideline?]
  • Publication
  • What to put in README
  • Java version
  • Build instructions

Build tools & Continuous Integration

  • Maven
  • Project structure
  • Versioning
  • Deploying to repository
    • [Where to publish]
  • Gradle
  • Don’t use it [Guideline]
  • Ant
  • Definitely don’t use it [Guideline] -

Static code analysis

  • Maven plugins
  • Code coverage
  • Static code analysis

Further reading

Recommended books, articles etc:

Google Java Style Guide