Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Coding Guidelies

Coding Guidelies

A pragmatic aproach

Awesome Incremented

April 21, 2016
Tweet

More Decks by Awesome Incremented

Other Decks in Programming

Transcript

  1. Code conventions (Wikipedia) •These conventions usually cover •file organization, •indentation,

    comments, declarations, statements, white space, naming conventions, •programming practices, programming principles, programming rules of thumb, •architectural best practices, etc.. •Conventions may be formalized in a documented set of rules that an entire team or company follows
  2. Types of Coding Guidelines •Code formatting •language specific, historical •IDE

    & Tool support •Clean Code •“Clean Code Developer” •“Understandable Code”
  3. 10. Classes 11. Systems 12. Emergence 13. Concurrency 14. Successive

    Refinement 15. JUnit Internals 16. Refactoring SerialDate 17. Smells and Heuristics Book “Clean Code” 1. Clean Code 2. Meaningful Names 3. Functions 4. Comments 5. Formatting 6. Objects and Data Structures 7. Error Handling 8. Boundaries 9. Unit Tests
  4. Comments • Comments Do Not Make Up for Bad Code

    • Explain Yourself in Code • Good Comments •Informative Comments •Explanation of Intent •Clarification •Warning of Consequences •TODO Comments •Javadocs in Public APIs • Bad Comments •Redundant Comments •Misleading Comments •Commented-Out Code •Javadocs in Nonpublic Code
  5. Error Handling • Use Exceptions Rather Than Return Codes •

    Write Your Try-Catch-Finally Statement First • Use Unchecked Exceptions • Provide Context with Exceptions • Define Exception Classes in Terms of a Caller’s Needs • Define the Normal Flow • Don’t Return Null • Don’t Pass Null