2024 Public Training Schedule
November 18 – 21, 2024 – Agile Analysis and Design Patterns
Half-Day Sessions
December 9 – 12, 2024 – Agile Analysis and Design Patterns
Half-Day Sessions
(c) 2024 To Be Agile
Back in the 1990s, when I was faced with multiple design choices, I’d have to code them up in multiple ways 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 have to evaluate each design choice in terms of its code qualities, and we’ll find better options. I find 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 on dealing 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 of 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.
{2 Comments }
Previous Post: « What I Mean by CLEAN
Next Post: Let Testability Guide You »
I completely agree with your conclusion to pick a few code qualities and focus on them. I wrote a very similar post last week that goes into the details of which principles and practices can help a developer focus on their preferred traits. I’d be interested to hear your thoughts on it.
Very nice post, Marc. Here’s a link so others can read it: https://marcroussy.com/2017/08/01/defining-code-quality/#more-2943
This post is referencing a series of posts I made about code qualities over the last several weeks. You can view the first post in the series here: https://tobeagile.com/2017/04/12/keep-it-clean/