Let Code Quality Guide You

DZone 's Guide to

Let Code Quality Guide You

Read on to see what an Agile expert has to say on the importance of code quality, and the principles he uses to guide his development efforts.

· Agile Zone ·
Free Resource

Back in the 1990s when I was faced with multiple design choices, I’d have to code them up in multiple ways in order to figure out which one was best. This was time-consuming, and evaluating design choices was one of the hardest things for me.

But now I have a better approach, thanks to code qualities. If we agree that CLEAN code is good code, then we simply have to evaluate each design choice in terms of their code qualities and we’ll find the better options. I find that this is a fast way of evaluating design choices and now that I do it all the time, I can make these evaluations almost instantly.

Each code quality represents a key aspect of code. Cohesion means that code is more focused to deal with only one thing at a time, and it makes code much clearer and more straightforward to work with. Loose coupling means the code is more independent and easier to test in smaller units. Encapsulated code can’t be overwritten by something external so it’s more reliable. Assertive code is more performant and better organized. Code that is nonredundant costs less to maintain and extend.

Each code quality represents an important aspect in code that when missing can distort the object model and make code difficult to work with in the future.

These code qualities guide me. They are my teachers in the pursuit of understanding good code and I find that when I pay attention to these code qualities, I end up building code that’s more maintainable, more straightforward to work with, that’s in better alignment with the principles of good programming, and I even discovered design patterns.

Understandability in code is for us humans. Computers don’t care but we should. In order to maintain software, we have to understand it. We have to start by building software in such a way that it’s understandable. Architects don’t go off and just draw whatever they want on a blueprint without paying attention to the standards and practices of their industry. In the software industry, we need to establish good standards and practices that we can follow just like builders and architects follow.

Pay attention to code qualities that will help you more than anything else to stumble upon the right designs and have you use principles, patterns, and practices that support good software development. Let code qualities be your teacher and guide you to build code that continues to provide value into the future.

But don’t stop with code. If CLEAN is fundamental to the way we understand the world, then we should see it reflected everywhere—and we do. Good communication is cohesive. Healthy relationships are loosely coupled. Well-formed ideas are encapsulated. Healthy people are assertive. And unique ideas are nonredundant. These same code qualities are in the arts, in sciences—they’re everywhere because they help us understand the world around us. And because they’re everywhere, because they’re at the foundation of how we humans understand, we can and must imbue our software with these same qualities so that it can be understandable to us.

The good news is you don’t have to focus on all five code qualities. Just pick one or two that make the most sense to you and focus on those. What you’ll find is that as you improve one code quality, all the other code qualities will improve as well. They are not independent of each other. In fact, they are very much interrelated, like facets of the same gem.

agile, clean code, code quality

Published at DZone with permission of David Bernstein , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}