Clean Code: A Handbook of Agile Software Craftsmanship is a “must read” for every software engineer book. I red this book a while ago and I think it is one of the best positions in programming techniques.
Book is quite huge, over 400 pages. Author requires from the reader some OOD knowledge. Book contains a lot of code in java so the reader has to be able to analyse it. Anyway for us, C# programmers switching to another OO language should not be a problem. Code samples are taken from real-world project FitNesse. First a “bad-smell” code piece is taken and described what could be improved and after that a better solution is provided. I think this way of learning is very good.
Author touches other important parts related to writing clean code:
- Why comments are not necessary
- Waht is a Meaningful Name” of class, variable, method etc.
- How should look like good method
- Difference between good and bad comments
- Data abstraction
- Unit Tests
- HOw format the code right
At this point the book is very similar to Implementation Patterns written by Kent Beck. But this is only the first part of it. The second and harder part is a big refactorization sample. Uncle Bob goes through the code step by step and explains what could be improved here and there. In my private opinion this part of the good is a very good lesson of “How to refactor”. In the future you will take the credits from this lesson.
Last chapters are guidelines for: comments, environment, functions, general, java,names and tests. Here only java is not very useful for C# programmer. The rest is brilliant !
Uncle Bob is trying to learn us new philosophy called “craftsmanship”, but this will one of my next posts here.