Nowadays, we heavily rely on software running all sorts of applications, from banking solutions to browsing through our social media. And, let's be honest, that last one is the most important of all these days. Because we are so dependent on software, companies have to make sure that the code runs smoothly at all times. For that, we need quality code. But what are the characteristics of quality code?
I have been reading the book series "Write Great Code" by Randall Hyde. The very first book of the series, Understanding the Machine, starts with defining what great code actually is. Of course, Hyde's opinion strongly influences the definition of great code in this book. However, it has prompted me to take a deeper dive in the subject and see what other opinions are out there.
When googling with search terms like "code quality" and "characteristics of quality code" the result vary a lot. The primary reason: each piece of software has different requirements. The definition of quality code depends on the requirements for the software. Say, you have an application that has to be super quick, then high speed is the characteristic of quality code. In that case, it might not be an issue that the portability of the software is practically non-existent.
There is no clear set of characteristic for quality code in place. However, you'll see that there is a set that many people in the software engineering industry agree upon.
These are just some of the common software quality attributes that students get taught during many software engineering courses. However, in the end, it all boils down to what the application requires. Since there are so many different quality attributes, you can always pick the ones that apply most for you. This Wikipedia page offers a list of system quality attributes that you can choose from for your next project.
Great code is software written using a consistent and prioritised set of good software characteristics. In particular, great code follows a set of rules that guide the decision a programmer makes when implementing an algorithm as source code.
- Randall Hyde; Understanding the Machine
Hyde gives this quote in his first book, in the very first chapter. This quote perfectly summarises what quality code should be. So, what are the characteristics of quality code? That depends on your requirements and what you want out of your system.