Favorite quotes from the book 'Clean Code'

I just went through my notes on the book, Clean Code, and thought I'd share what I thought were some of the best quotes and “lessons learned” from reading that book.

Today I’m just going to share the notes I made as I read through the book, and then at some point I might come back here and add some additional explanation to each thought.

  • The feeling of “wading” through bad code. [As a reader of some source code, you feel like you’re wading because the writer of the code didn't know what they were doing, or didn’t care.]
  • LeBlanc’s Law: Later = Never. [This is in reference to saying, “I’ll clean it up later,” and of course you get too busy, and never do.]
  • Defend the code with equal passion. [Business people attack you and want you to sacrifice quality to go faster. It’s like saying to a surgeon, ”Stop all that silly hand washing before surgery.”]
  • The only way to always go fast is to keep the code as clean as possible.
  • Clean code looks like it was written by someone who cares.
  • You can call it beautiful code when the code makes it look like the language was made for the problem.
  • Every time you write a comment, you should grimace and feel the failure of your ability of expression.
  • The time spent reading code versus writing code is ~10:1. Therefore, writing code that is easy to read makes you faster.
  • Leave the campground cleaner than you found it. [I think this was a Boy Scout motto, and it’s also a slogan used at the public campgrounds and rentals in Alaska.]
  • Name your methods using a verb-phrase or verb-name.
  • The LOGO language used the word “To” like Scala and Ruby use “def,” so the code read like a top-down set of “TO” paragraphs, like “To login ...”
  • The Single Responsibility Principle.
  • The Open-Closed Principle.
  • The Step-Down Rule.

If you haven’t read it, there are a lot of nice little tidbits in Clean Code. There is also a lot I don’t agree with, so I can’t wholeheartedly recommend it, but you can look at that as a way of saying that the book makes you think about whether you agree with the statements, or not.