Professional Documents
Culture Documents
readable code
Denisa Trif
Because...
- ...Claudia said so
- ...Your audience isnt just a computer
- ...It proves good software design skills
- ...Clean code is about caring
Naming standards
o Classes substantives
o Methods verbs
Avoid misinformation
Use pronounceable names
Use searchable names
Meaningful distinctions
Methods
Line limit
Comments
GOOD
Informative comments
Explanation of will
Clarification
Warning of
consequences
TODOs
BAD
Misleading comments
Noise comments (e.g. for
constructors)
Error handling
- dont pass null
- dont return null
Classes
Order:
1. Public static constants
2. Private static variables
3. Private instance variables
4. Public functions
- private utilities called by a public function right after the
public function itself
Classes should be small
Class names including weasel names like Processor, Manager or Workflow
ofthen hint an unfortunate aggregation of responsibilities
- We should also be able to write a brief description of the class in about
25 words, without using the words if, and, or, or but.
No pressure...
References
http://blog.pluralsight.com/7-reasons-clean-code-
matters
Clean Code, Robert C. Martin