The Importance of Code Quality, Explained

Written by srishti-says | Published 2020/05/30
Tech Story Tags: software-development | code-quality | software-development-tips | programming | software-engineering | productivity | coding

TLDR In software development, quality should be everyone’s priority. Code quality loosely defines how useful and maintainable the code is in the long-term. Code that can be carried over from product to product, developed further, maybe even open-sourced after establishing its value is of high quality. Good quality code can speed up software development since it can be reused and developers don’t have to spend that much time fixing old bugs and polishing code. Good programmers write code that humans can understand.via the TL;DR App

One would expect that writing code which any programmer can read and understand would be an inherent skill of software developers. The fact is that only 20% of programmers have this ability. The code that you are writing must be understood not only by the machine but also by humans. In software development, quality should be everyone’s priority. Throughout the development process, the goal should be the delivery of good quality and working code.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
— Martin Fowler

What is Code Quality?

Code quality loosely defines how useful and maintainable the code is in the long-term. To put it more formally, code quality comprises a group of different attributes and requirements, determined and prioritized by your business. This implies that a code that can be thrown away tomorrow is of low quality. On the other hand, code that can be carried over from product to product, developed further, maybe even open-sourced after establishing its value is of high quality.
So for a piece of code to be considered of 'good' quality, it should follow a minimum of the following requirements:
  • It should do what it is supposed to do.
  • It should follow a consistent style.
  • It should be easy to understand.
  • It should be well-documented.
  • It can be tested.
Measuring programming progress by lines of code is like measuring aircraft building progress by weight.
— Bill Gates

Why should you care about Code Quality?

Let me give you an example here. Everyone likes to read a good story. For a common man who is not literature erudite, a good story is the one that can be easily read and understood. Great authors write books with compelling stories that are easy to read and understand. Just like the author’s writing has to be easy to read and comprehensive, so should a software developer’s code. After all, the code is, in some ways, a developer's story.
It may be tempting to compromise on the quality to meet your deadline, but if you want your code to stick in the long run, it is essential to produce code that meets all the standards of code quality. The quality of your code defines you as a developer. You may be a damn good coder, who can cook up 100 lines of code in 10, but you need to visualize from maintainability point of view. Will the one who maintains this project or your colleague be able to understand what your genius mind is thinking?
Moreover, good quality code can speed up long-term software development since it can be reused and developers don’t have to spend that much time fixing old bugs and polishing code. It also makes it easier for new project members to join the project. All this, in turn, lower the technical debt.

How to improve Code Quality?

Now that it is established that code quality is an integral part of software development, I am sure you would want to know how can you improve code quality? So here is a list of things that can be done to improve code quality:
  • Setup version control and code reviews.
  • Follow continuous integration.
  • Determine and follow coding conventions.
  • Run tests.
  • Analyse bugs.
  • Measure your code quality.
I am sure these look like a mixture of jargon. So here is a beautifully compiled article to help you understand more about each of these points.
Here is a piece on Code Quality Standards by Consortium for Information and Software Quality.
If you are a voracious reader like me and trust books for everything, you may have a look at this book written by Robert "Uncle Bob" Martin called Clean Code: A Handbook of Agile Software Craftsmanship.
Thank you for reading. Hope to see you in the next article. Till then, don't forget that you're amazing.

Written by srishti-says | A 22 year old Software Developer, avid Reader and aspiring Writer
Published by HackerNoon on 2020/05/30