Clean Code: a Handbook of Agile Software Craftsmanship

Writing code that is easy to read and easy to test is difficult to achieve. The fact that poorly written code can function often leads to coding practices that are effective but not necessarily efficient. Too often, many programmers fresh out of school write code in the manner that was effective for passing their courses, but contains a lot of spaghetti.

Experience and continual learning will eventually improve coding skills, but if you want to improve quickly I recommend a book that helped me raise my coding skill to a new level. Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin is an excellent resource on the art of writing easily readable code. The book challenges the reader to think about what’s right about code, and what’s wrong with it.

Readers will learn:

  • 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

What makes this book stand out from the others is that the information is presented in a manner that allows you to adapt and improve upon what you already know. Other books I’ve read introduced great methods, but required a lot of time to learn. It’s fine if you have the extra time, but most of us don’t. After reading the book I was able to start applying what I learned on a current project.

My experience

I selected a project that allowed me to slow down a bit so I could apply several of the practices outlined in the book. The important part for me was starting with small steps and repeating them. Pretty soon I found a new coding rhythm, enabling me to incorporate even more improvements. Putting what I learned into practice every day and not trying to do too much at once was key for me.

I started by writing unit tests the way they were outlined in the book. At the same time I also identified and was able to modify several code smells. Next, I modified the members of my classes so they had better names. I also moved some logic to sub-classes and made several refactoring modifications. The first results weren’t ground breaking, but they were a big step in improving my ability to write consistently clean and testable code.

I especially liked that I didn’t need to spend time creating practice applications. I was able to take the project I was working on and make it better! If you follow my example, you can improve your coding ability and have fun doing it while saving yourself a lot of frustration. The important thing is don’t expect to achieve super results the first time. It’s a process that requires practice, but because it builds on what you already know, it doesn’t require extra time. I just took small steps like the book suggested and I was able to progress quickly.

Threading guide

Besides writing clean code, the author also introduces testing problems. There is a very good section about testing threaded code, the pitfalls, and how to deal with them. Given my level of understanding of the subject, I consider this one of the best essays on threading I have read. It is not a hard-to-read technical piece, but beginners may need to research some of the definitions to understand it thoroughly.

My special thanks to Robert C. Martin

I want to give special thanks to Robert C. Martin for writing this book. Many books on coding have a steep learning curve before you start getting results, and others point you in the direction to go then leave you alone on the path not knowing what to do.

Clean Code gives you a lot more than technique. It also talks about mental tools to use to really sharpen your skills. Clean Code is top-level book. Get a copy and read it. You will never regret your decision. I promise.

Gunnar Peipman
Gunnar is the CEO of Developers Team Ltd, an Estonian software development company. He has been using Microsoft platforms and technologies since primary school. The maniacal interest and enthusiasm of developing systems and playing with bleeding edge technologies is still with him. His career working with .NET and related technologies started in 2003. Gunnar specializes in ASP.NET web applications, SharePoint and SmartCard technologies. To contact Gunnar, email him at: gunnar@developers-team.com.

The Related Post

Janet Gregory draws from her own experience in helping agile teams address alternative ways to cope with roadblocks including projects without clear documentation, testers with limited domain knowledge and dealing with either black box or white box testing. For testing on projects without clear documentation, is exploratory the only method? I often make “tester errors” ...
Michael Hackett sat down with FNC’s Chris Floyd to get his take on numerous Agile topics.
Author Jonathan Rasmusson explains in his latest book how to successfully set-up, execute and deliver Agile projects. Download the excerpt below for “Chapter 7: Estimation The Fine Art of Guessing.” To read his interview in last month’s issue, please click on “Spotlight Interview: Jonathan Rasmusson” to read his views on the best practices for test ...
Testing is often looked upon by many as an unmanageable, unpredictable, unorganized practice with little structure. It is common to hear questions or complaints from development including: What are test teams doing? Testing takes too long Testers have negative attitudes
Armed with the right tool or set of tools, a development team can incorporate ALM into its Agile process and start reaping the benefits of Agile ALM. As the software development industry matures, it is devising methods for ushering products from inception to completion—a process that has come to be known by the buzzword ALM ...
Team collaboration is essential for testing embedded systems. Developing software for an embedded system often carries more risk than for general purpose computers, so testing is extremely critical. However, there still has to be a good balance between time spent on testing and time spent on development to keep the project on track. As consultants ...
Keeping an eye on the horizon in the testing world is an important part of staying in the game. Hans is no stranger to looking to the future with eyes wide and ears open. His expertise is what makes Hans valuable at the STARWEST Expo, which he recently delivered two talks to.
Take our quick survey on Testing in an Agile Development Team! Agile‘s impact on software development teams is huge. For test teams it can be even more pronounced — and good, especially if your existing projects have been problematic. There are many positive things about the move to be more Agile and responsive in software ...
One of the challenges with building an application these days is the number of dependencies that application will actually have on other applications. Ideally in order to know how that application will actually perform, application developers would be able to test their application against the application it depends on running in production. The odds of ...
Testing in Agile Part 1 – INTRODUCTION TO AGILE In case you missed the first part of the series in our last magazine issue from Michael Hackett, Agile’s impact on software development teams is huge. For test teams it can be even more pronounced — and good, especially if your existing projects have been problematic.
One of the features of using Agile methods is the opportunity for continuous improvement within a project. There are a number of improvement opportunities throughout a typical iteration or sprint─over the next few weeks I’m going to walk through a few, starting this week with the Retrospective. Retrospectives are one of the many tools in ...
Video narrated by MICHAEL HACKETT – Certified ScrumMaster This is Part Four of a Four Part Video on “New Roles for Traditional Testers in Agile Development” Michael shares his thoughts on “A Primer – New Roles for Traditional Testers in Agile”   LogiGear Corporation  LogiGear Corporation LogiGear Corporation provides global solutions for software testing, and ...

Leave a Reply

Your email address will not be published.

Stay in the loop with the lastest
software testing news

Subscribe