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 the 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.
Again, these are just short notes right now, and I'll try to come back and add more to these over time. That being said, I doubt LeBlanc's Law will allow me to do so. :)
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 at $50 or even the current price of $33, I can't recommend buying it, but it's worth $15 as an eBook.
HELP! if this article was helpful, please share it. (i can use all the links i can get. thanks, alvin)