Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info
titleGuidelines

This document lays down coding guidelines, best practices and gotchas for developers to keep in mind.

...

  1. Coding styles are important but not overbearing.
  2. Code is neat, readable. 
  3. Follow SOLID principles
  4. DRYdivide code and logic into small reusable units - reuse. Less code is good
  5. 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)
  6. 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!
  7. 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.   
  8. Loops have definite set length and correct termination conditions.
  9. Use Java paradigms like 
    • Use of closeable in try-with-resources
    • Using streams
    • Loops like “names.forEach”
    • Lambda expressions
  10. The code must not break any existing feature during upgrades
    1. Data migrations if needed must be done so as to persist and keep working with existing transactional data.
    2. 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.
    3. Feature behaves, as much as possible, like before and is easy to pick up and preferably does not require retraining of end users.
  11. 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.)

...