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

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.
LogiGear Magazine – July 2013 – Agile Testing
The No-Nonsense Guide for How to Write Smarter and Low Maintenance Test Cases Test design is a phrase that is often used when planning testing and test efforts, but I do not believe it is well understood. Also, opinions vary widely about the importance of test design ranging from irrelevant to the crucial ingredient for ...
LogiGear Magazine – November 2010
When quality assurance teams and management who have adopted Agile practices first put the ideas to work, they face a significant impediment in unlearning the traditional mind-set and practices that experience in traditional practices has instilled in them. “He who knows to unlearn, learns best.” — Anonymous The following are some of the key aspects ...
LogiGear Magazine July 2012 Testing in Agile  
Mark Levison has over twenty years experience in the IT industry, working as a developer, manager, technical lead, architect, and consultant. He discovered Agile in 2001 and is now a Certified Scrum Trainer and Agile Coach with Agile Pain Relief Consulting. Levison has introduced Scrum, Lean and other Agile methods to a number of organizations and coaches from ...
Agile is here to stay. Once the radical alternative to Waterfall development methods, these legacy methodologies are being disrupted and replaced by Agile practices that improve time-to-market, reduce development costs, and produce higher quality software that better meets customer expectations. As the world demands more software, development teams – from scrappy startups to big corporations ...
Agile Automation Michael Hackett – Senior Vice President – LogiGear Corporation Michael Hackett Michael is a co-founder of LogiGear Corporation, and has over two decades of experience in software engineering in banking, securities, healthcare and consumer electronics. Michael is a Certified Scrum Master and has co-authored two books on software testing. Testing Applications on the ...
Build the right test platform including infrastructure, virtual lab and process. Testing embedded software is both similar and dissimilar to application software testing. The first eye-catching thing is that embedded software is significantly less visible to the end user. User interfaces are limited; there may be a console-based text menu, a simple command line interface, ...
If your Agile implementation is not about people, you’ve missed the boat! The most profound impact to becoming more Agile is happier teams! Agile manifesto Value #1: * Individuals and interactions over processes and tools Words like these do not show up in Waterfall or RUP SDLC process descriptions. Agile cannot get more basic than ...
Michael Hackett sat down with FNC’s Chris Floyd to get his take on numerous Agile topics.

Leave a Reply

Your email address will not be published.

Stay in the loop with the lastest
software testing news

Subscribe