Just like anything else, code can be created to all kinds of different standards. When we talk about high quality code, we mean code that behaves as required, but also code that is simple to maintain and secure. Getting to this point, however, isn't as easy as you might think.
To get to grips with code quality, we first need a good understanding of what code is in the first place. This can be simply defined as the unambiguous expression of business requirements in a format that a machine can understand. It is a description of required action that a machine can read and carry out.
When software engineers write code, they often make revisions as they refine their understanding of the problem space and the requirements and how they want the machine to behave. The quality of the code directly impacts the ability of the engineer to read it, understand what it is intended to do, and change it. When code is of poor quality, this process is much more difficult — acting as a blocker to the development process and introducing bugs, errors, and vulnerabilities much more likely.
There are some simple ways of ensuring code quality, such as following good formatting practices and naming conventions. Other principles such as SOLID describe how to structure complex code in a way that ensures it is readable and easy to maintain.
Code quality is an extremely important part of any rigorous software engineering process. Poor quality code leads to delays in releasing products and services, security flaws, and spiralling costs — as software becomes challenging to maintain and extremely difficult to alter when new functionality is required. It should therefore be a high priority of the entire engineering team as well as senior leadership in any organisation. For more context, read our article on why code quality matters to your organisation.
The lowdown on code quality
- Engineering practices which support readability and maintainability of code
- Ensure code quality with code reviews, refactoring, testing, and good communication between team members
- Take code quality seriously to minimise business risks: including security flaws, project delays, user experience issues and dissatisfaction amongst customers and staff
Our recent insights
FAIR data - what is it and why should you care?
One of our senior data consultants, Dr Alasdair Gray, explains what FAIR data is, who’s using it, why it’s so useful and some common misconceptions around it.
Do you know how to destroy your data securely?
In this final part of our data ethics series, we look at what data destruction is and how you can comply with GDPR required actions.
Discussions in data ethics: How to develop data ethics in local government
In the final part of the Discussions on Data Ethics series, Professor Paul Clough, TPXImpact and Lucy Knight, ODI, discuss data literacy, effective community involvement and the value of bad news.