Uncle Bob, Lesson 2
“Uncle Bob” is Robert Martin of CleanCoder. You may have heard of the Agile Alliance, Extreme Programming, and the SOLID principles. That’s “Uncle Bob”.
I align much less loosely with Uncle Bob’s advice in this lesson than the one on Lesson 1 - Clean Code. I think part of that is the different ways of thinking about Java/C++ and anything else.
What is the purpose of a comment?
- to explain the purpose of the code if the code can’t do it on its own
- nothing is quite so helpful as a good comment
- nothing is quite as bad as an obscuring comment
- proper use is to compensate for our failure to express ourselves in code
- every use of a comment represents a failure
- comments lie
- degrade over time
- people don’t update comments
- put the effort into the code, not the comment
- mandated comments (every var must be…) are stupid comments
- How long should a source file be?
Rule for variable names
- Length of name proportional to length of scope