Versions Compared

Key

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

...

  • The mobile browsers (iPad and Android) do not support parsing ISO dates. Avoid using new Date(dateString) for parsing dates. Use DateUtil.parse() instead (which uses moment.js).
  • In order to disable a "Submit" button, rely on checking the form's validity, rather than checking if a validation method passes. Make validation methods mark the input control as invalid, which indirectly will make form as invalid. That way the Submit button will get enabled only if the form is valid, which means all input controls on the form is valid. This will keep your submit method enabled/disable logic straightforward.
  • Avoid using self-closing html tags for span, divs. The <span/> will be converted to <span> by grunt html validator and minifiers. The "dist" doesn't work as expected. Use <span></span> instead of <span/>. See http://stackoverflow.com/questions/3558119/are-self-closing-tags-valid-in-html5

  • More angular guidelines related to performance boost is here.


General Guidelines for Code

  1. Coding styles are important but not overbearing.
  2. 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.
  3. Unused code
    1. 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!
    2. Duplicate code - maybe create another card?
  4. Encourage using Java 8 paradigms
    1. Use of closeable in try-with-resources
    2. Using streams
    3. Loops like “names.forEach”
    4. Lambda expressions
  5. DRY - don’t repeat yourself please.
  6. Loops have definite set length and correct termination conditions.
  7. 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.)
  8. ROT code? - surely someone has come up against it? Use a known library if you can’t find already plugged in.  
  9. SOLID principle


References

There are enough guidelines available on internet to help you. 

Java

  1. https://www.javacodegeeks.com/2015/06/java-programming-tips-best-practices-beginners.html
  2. https://medium.com/@rhamedy/a-short-summary-of-java-coding-best-practices-31283d0167d3
  3. Oracle technet (now archived) - https://www.oracle.com/technetwork/java/javase/documentation/codeconventions-137265.html
  4. https://docs.oracle.com/cd/A97688_16/generic.903/bp/java.htm


React 

  1. https://reactjs.org/docs/thinking-in-react.html


Angular

  1. TODO


Python 

  1. https://airbrake.io/blog/python/python-best-practices