Kotlin Playbook
How we write (backend) Kotlin code in the Content Acquisition domain of Springer Nature Digital IT.
A living document
We follow the standard Kotlin coding conventions, although our codebase predates these, and so may occasionaly diverge for historical reasons.
Beyond the standard coding conventions, we have the following rules of thumb:
Organising the codebase:
- Classes, Methods, and Extension Functions
- Extension functions to avoid bare calls to copy
- Organising code into files
- Deployable and library modules
- Tests and supporting code
Design style:
- Immutable domain models
- Pipelines of transformations
- Reporting and handling errors (exceptions, null, monads, etc.)
- Speed bumps
- Monitoring events, rather than static loggers
Testing:
- Testing code that parses data from the network
- Testing code that writes data to the network
- Testing multithreaded code
Things we avoid (in production code):