What is code quality?
Code quality refers to how well written the code is. Quality code is clear, simple, well tested, bug-free, refactored, documented, and performant. But the primary measure of high-quality code is its compliance with the specifications provided by the individual/organization who needs the code.
Code quality is like writing quality.
You can write a paper in 7th grade, working on your very first essay. You can also write a paper at 50 years old being a professional author.
Both papers may be working to explain the same concept or tell the same story, but you can likely distinguish that the quality of the writing of the author is better than the 7th grader.
In other words:
Code quality is a reflection of the proficiency of the developer and a signal as to the quality of the end product.
Why is code quality important?
It's one thing to know what a term means, but that is worthless if you don't know why you should know what code quality is in the first place. Let's break down the importance of this tech term based on two high level categories. We'll walk through an explanation as well as provide a score, 1-10, that shows you how much you should care about code quality.
The first will be if you do not have a product yet. This means that you don't have a physical product. Maybe you're in the ideation phase, or maybe you're almost ready to start development. Whichever it is, we'll get into why code quality is important and why you should or shouldn't care about it if you do not have a product.
Before getting started on your product, you should know what level of quality you are looking to build with. If you're going for an MVP, then you probably don't need high quality, but if you already have a waitlist of over 1k individuals, then you probably want to have higher code quality.
Live Product: 6/10
The second category is if you do have a live product. Maybe you just launched your business or maybe it's been live for years and you're continuing to improve its quality. Regardless of the scenario, if your product is live, code quality carries a different weight.
Once your product is live, it is important to maintain and improve your code quality. Sometimes you need to refactor your codebase to make it run more smoothly. Other times, if your code is really poor quality, you may be better off just starting over from scratch.
Examples of code quality
So you know what code quality is, by definition. You know if you should care about it or not depending on your situation as a business/company/product. To dig in deeper, we will walk through some examples so we can make sure you really have a solid grasp on code quality.
Three types of code quality:
To really understand code quality we're going to focus on the concept of technical debt, or the cost of re-doing work caused by choosing an easier and quicker solution rather than a more difficult but stronger one.
- Low technical debt
If you are a mature product with thousands of users, you will need to have really strong code. The weaker the code you have, the more likely you are to have bugs and crashes. So, in order to prevent this from happening, you want to be sure that your code quality is top-notch. Keep in mind, when choosing low technical debt, you are choosing High Quality in exchange for Higher Cost and Longer Timelines.
- Medium technical debt
If you have just launched a product and have paying users but haven't really come near your inflection point of product-market fit, then maybe you have a more medium appetite for technical debt. This means that you want something in the middle of the road when it comes to code quality and its relative cost and timeline. So, you are choosing Medium Quality in exchange for Medium Cost and Medium Timelines.
- High technical debt
If you are at the beginning of your product development, then you definitely want to build with a lot of technical debt. As a startup, since you can iterate quickly, technical debt is actually your best friend! It will allow you to test the most amount of assumptions for the least amount of time and money. Once you start to validate an avenue, then you start to repay the technical debt by spending more time optimizing the code for what sticks. So, with high technical debt, you are choosing Low Quality in exchange for Lower Costs and Faster Timelines.
- Code quality is a reflection of the proficiency of the developer and a signal as to the quality of the end product.
- Whether you do or don't have a product, you need to understand the implications of code quality and why some people choose good code and others intentionally choose poor code.
- There are three general categories that reflect your code quality selection: low technical debt, medium technical debt, and high technical debt.