Recommendations
Table of contents:
General coding
Do's
- Specify units with quantities
- Use brackets for control flow statements
- Use LF as line separator
- Every file ends with an empty line
- Use 4 spaces for indentation
- Fail fast using conditional failures
- Write expressive code and put effort into naming things. Comments are the last resort
- Use SOLID principles plus composition over inheritance [1]
- Use immutable data structures
- Create semantic data types instead of using primitives
- Use ASCII order when in doubt about orderings things
- Use ISO 8601. See also RFC 9557, RFC 3339 vs ISO 8601
- Use Test Doubles
Don'ts
- Don't have circular class/module/package dependencies
- Don't use greater-than signs
>/>=. Write0 < limit && limit <= 10instead - Don't use negation
!. Writeexpression == falseinstead - Don't use preincrement/postincrement operators
i++. Writei = i + 1instead - Don't violate class/module/package boundaries. If A depends on B, then B must be written like it has no knowledge of A
Java
Do's
- Write documentation using Markdown JavaDoc and Snippets
- Use
Optional. See also [1], [2] - Use records and sealed interfaces. See also [1]
- Use structured concurrency, scoped values, virtual threads and primitives like atomics, locks and semaphores
SQL
Do's
- Follow SQL Style Guide
ECMAScript
Do's
- Place semicolons
- Use
=== - Use double quotes
"s" - Use JSDoc for type safety. See also [1]
Don'ts
- Don't let commas dangle
Sofware development lifecycle
- Biweekly dependency update
- Check release notes for major/minor version changes