Clean Code - Naming

  1. Use Intention-Revealing Names

  2. Avoid Disinformation

  3. Make Meaningful Distinctions

  4. Use Pronounceable Names

  5. Use Searchable Names

  6. Avoid Encodings

  7. Avoid Mental Mapping

  8. Class Names - should have noun or noun phase names

  9. Method Names - should have verb or verb phase names

  10. Don’t be cute

  11. Pick one word per concept

  12. Don’t pun - don’t use the same word for two purposes

  13. Use solution domain names

  14. Use problem domain names

  15. Add meaningful context

  16. Don’t add gratuitous context

Clean Code - function

  1. Small

  2. Blocks and Indenting

  3. Do one thing

  4. One level of abstraction per function

  5. Reading code from top to bottom: the Step Down Rule

  6. Switch statements

  7. Use descriptive names

  8. Function arguments - the less the better

  9. Common monadic forms *,Dyadic functions, Triads, Argument objects, Agrument Lists,

  10. Flag arguments - passing a boolean into a function is a terrible practice

  11. Verbs and keywords

  12. Have no side effects - do not lie in function

  13. Command Query Separation - don’t return different meaning in one function

  14. Prefer exceptions to return error codes

  15. Extract try/catch blocks

  16. Error handling is one thing

  17. Dependency magnet. don’t enum the errors

  18. Don’t repeat yourself

  19. Structured programming

Clean Code - Error Handling

  1. Use Exceptions rather than Return Codes

  2. Write Your Try-Catch-Finally Statement First

  3. Use un-checked exceptions *

  4. Provide context with eceptions

  5. Define exception classes in terms of a caller’s needs

  6. Define the normal flow

  7. Don’t return null

  8. Don’t pass null

Clean Code - TDDs 3 laws

  1. First Law - You may not write production code until you have written a failing unit test.

  2. Second Law - You may not write more of a unit test than is sufficient to fail, and not compiling is failing.

  3. Third Law - You may not write more production code than is sufficient to pass the currently failing test.