I just finished reading this book: Clean Code: A Handbook of Agile Software Craftsmanship Clean Code: A Handbook of Agile Software Craftsmanship. It’s the best professional book I have ever read. This book gives excellent advices to write clean code which is highly readable and well structured. The code examples provided in this book is as good as an article. The reading experience is really smooth. Also, the author as a sense a humor, which makes the book more fun than the others.

I think the table of content of this book tells about every thing it mentions. I don’t want to repeat here. Every chapter worths every minute I spend on reading.

My personal take on this book is that restructuring code needs time and practices. Test provides a safe foundation for us to restructure code. On the other side, this book provides the suggestion for writing clean code:

  • Variable should has names with clear meanings. Long name is not problem if it’s clear.
  • Functions should be short.
  • One function should only do one thing.
  • It’s better to encapsulate if conditions into functions.
  • The difference between data structures and objects is clearly explained.
  • Most important, it gives me the courage to restructure code and insist on good practices.