Info | ||
---|---|---|
| ||
This document lays down coding guidelines, best practices and gotchas for developers to keep in mind. |
...
- Coding styles are important but not overbearing.
- Code is neat, readable.
- Follow SOLID principles
- DRY - divide code and logic into small reusable units - reuse. Less code is good
- ROT code? - surely someone has come up against it? Use a known library if you can’t find already plugged in. At the same time, you don't want to a introduce a library dependency for relatively simple and singular purpose. (e.g. introduce commons-lang library for a function that checks a string for being null or empty)
- Unused code - Don’t carry dead code, including commented off code is not useful and just baggage and often confusing. We use git anyways and all editors show a pretty good diff between versions!
- Create a "TECH DEBT" card, if you notice too much of duplicate code already in existing codebase, but you don't have the time to do that yourself.
- Loops have definite set length and correct termination conditions.
- Use Java paradigms like
- Use of closeable in try-with-resources
- Using streams
- Loops like “names.forEach”
- Lambda expressions
- The code must not break any existing feature during upgrades
- Data migrations if needed must be done so as to persist and keep working with existing transactional data.
- Configuration if introduced must have the previous behavior as the default, with options of extending/changing the behavior. Meaning, using existing configuration with new code does not require updates by any implementation. Configurations are documented and reflected with the release version indicated.
- Feature behaves, as much as possible, like before and is easy to pick up and preferably does not require retraining of end users.
- Is the code performant? Has it been tested with enough representative data? (Ask the contributor to share what they've done, or test it yourself if you have concerns.)
...