Increase Quality Today to Increase Velocity Tomorrow

I always tell teams the way to increase velocity tomorrow is to increase code quality today. Focusing on code quality keeps the software we write clear and easy to understand.

Our brains have been conditioned to understand information when it contains these qualities, so code that exhibits these qualities is easier to understand and work with. Quality software helps us extend our software without creating a mess and this allows our projects to scale.

Quality software is also much easier to debug. This helps us deliver faster and makes the code easier to maintain, reducing the total cost of ownership and paying for itself very quickly.

Ward Cunningham[44] coined the term technical debt to express what can happen when developers don’t factor their learning back into their code as they’re building it. Nothing slows development down and throws off estimates more than technical debt. What should take an hour can take a day or more and sometimes adding a feature can require a great deal of code to change. Improving code quality can bring down the cost of change and make estimation more predictable.

Sometimes developers have to go fast, and sometimes that means being sloppy. If you have to cut corners, you also want to clean up after yourself before you make too much of a mess. When you adopt practices that support quality, it won’t take much more time to write code that is higher quality in the short term and it will save a lot of time in the long term. Sure, you have to type a few more curly brackets to encapsulate code in separate classes, but since when was typing the bottleneck in software development?

I have a friend who is a professional chef and responsible for putting out more than two hundred plates a night. He says, “I don’t have time to make a mess,” because he knows working fast is working clean. His workstation is always neat and tidy. His sleeves are clean and dry. The faster he works, the cleaner he works. And so should we.

You probably remember these code qualities from an old book or computer science course you took, terms like cohesion and coupling or encapsulation. I keep discovering that many of these ideas are at the foundation of the best software I’ve seen. The most successful organizations—the ones whose velocity was so great they could consistently respond to the business and provide the best software to their customers—all had a base of high-quality software to work from. They built a culture that focused on code quality and everything else flowed from there. I think this was one of their keys to success.

And once you know how to write CLEAN code, the best way to be sure you’re writing high-quality, testable code is to write the test first, and that is the topic of our next chapter.