27 05 2010
Clean Code: A Handbook of Agile Software Craftsmanship
Writing code that is easy read and test is not something that is easy to achieve. Unfortunately there are still way too much programming students who write awful spaghetti after graduating. But there is one really good book that helps you raise your code to new level – your code will be also communication tool for you and your fellow programmers.
“Clean Code: A Handbook of Agile Software Craftsmanship” by Robert C. Martin is excellent book that helps you start writing the easily readable code. Of course, you are the one who has to learn and practice but using this book you have very good guide that keeps you going to right direction.
You can start writing better code while you read this book and you can do it right in your current projects – you don’t have to create new guestbook or some other simple application to start practicing. Take the project you are working on and start making it better!
Well, telling good words about book has no point without experimenting. When I read the book I took one of my not-so-hurry projects and started to apply practices from this book. Well, there is some mindshift, yes, but it is easy to get over it if you don’t take too large steps. Go with small steps and repeat them. Pretty soon you have your first experiences and new coding rhythm. The important thing is – practice every day and don’t hurry because your own style must be worked out in thoughtful way.
I started with writing some unit tests the way Clean Code showed. Same time I also modified code that has some smells. Then I modified the members of my classes so they had better names. I moved some logic to subclasses and made some other refactoring tasks. Don’t be surprised if you don’t achieve super good results at first time, you have to practice, practice, practice. But you will find it pretty easy and fun if you take small steps at first place.
The first results I achieved was really a big step towards to clean and testable code. I mean I did no complex things or any time consuming things. I just took small steps like Clean Code suggests and I was able to get move quickly. First small steps on code cleaning give you experiences you need on making your second and your third step. Continuous practicing makes you very good on clean code pretty soon. By example, I am pretty happy with the code that I cleaned to level the book told me. I took some volunteer over-hours just to try things out on real stuff. And it worked, okay, still works. 🙂
Besides writing clean code the author also introduces testing problems. Besides usual TDD stuff which was interesting reading there is very well discussion about testing threaded code and what kind of dangers there are and how to get over them. This far I consider threading part of this book as one of the best essays on threading I have ever read. It is not hard to read scientific story, even beginners should be able to read it although some help from Google/Bing may be needed.
My special thanks to Robert C. Martin
I want to say my special thanks to Robert C. Martin for this book. There are many books that teach you different stuff and usually you have markable learning curve to go before you start getting results. There are many books that show you the direction to go and then leave you alone figuring out how to achieve all that stuff you just read about.
Clean Code gives you a lot more – the mental tools to use so you can go your way to clean code being sure you will be soon there. I am reading books as much as I have time for it. Clean Code is top-level book for developers who have to write working code. Before anything else take Clean Code and read it. You will never regret your decision. I promise.
Fragment of editorial review
“Even bad code can function. But if code isn’t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn’t have to be that way.
What kind of work will you be doing? You’ll be reading code—lots of code. And you will be challenged to think about what’s right about that code, and what’s wrong with it. More importantly, you will be challenged to reassess your professional values and your commitment to your craft.
Readers will come away from this book understanding
- How to tell the difference between good and bad code
- How to write good code and how to transform bad code into good code
- How to create good names, good functions, good objects, and good classes
- How to format code for maximum readability
- How to implement complete error handling without obscuring code logic
- How to unit test and practice test-driven development
This book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.”
Table of contents
- Clean code
- Meaningful names
- Objects and data structures
- Error handling
- Unit tests
- Successive refinement
- JUnit internals
- Refactoring SerialDate
- Smells and heuristics
- A Concurrency II
- Cross references of heuristics