More on this book
Community
Kindle Notes & Highlights
Read between
April 17 - November 9, 2017
First, it is through practice in the small that professionals gain proficiency and trust for practice in the large.
We abandon our code early, not because it is done, but because our value system focuses more on outward appearance than on the substance of what we deliver.
We will never be rid of code, because code represents the details of the requirements. At some level those details cannot be ignored or abstracted; they have to be specified.
But being able to recognize good art from bad does not mean that we know how to paint. So too being able to recognize clean code from dirty code does not mean that we know how to write clean code!
The Boy Scout Rule
Leave the campground cleaner than you found it.5
When constructors are overloaded, use static factory methods with names that describe the arguments.
More than three (polyadic) requires very special justification—and then shouldn’t be used anyway.
When a function seems to need more than two or three arguments, it is likely that some of those arguments ought to be wrapped into a class of their own.
Functions should either do something or answer something, but not both.
When you return an error code, you create the problem that the caller must deal with the error immediately.
Functions should do one thing. Error handing is one thing. Thus, a function that handles errors should do nothing else.
The proper use of comments is to compensate for our failure to express ourself in code.
that the only truly good comment is the comment you found a way not to write.
Rather than venting in a worthless and noisy comment, the programmer should have recognized that his frustration could be resolved by improving the structure of his code.