<img alt="" src="https://secure.torn6back.com/217076.png" style="display:none;">
The 21st century executive

How Code Quality Affects ROI and Why You Should Be Tracking It

Code quality

Your software is only as good as the code it runs on. One of the best ways to manage software product success and utility is by tracking code quality. Code quality measures how well the underlying code of an application runs, how well it’s written, and how easy it is to maintain.  

For many software businesses, however, code quality can often take a backseat when other priorities are on the line. Left unchecked, this can end up costing you in the long run.  

Download free eBook: Software Essentials for Business Leaders

Here, we’ll look at what code quality means for ROI and what you can do to track it. 

How does code quality affect ROI?  

You might be wondering, “If the software works, then what’s the problem?”. It may not be apparent when your software runs, but poor code quality can turn into serious technical debt. While a bit of tech debt isn’t necessarily a bad thing, too much can have negative implications for your ROI.  

Code quality has a direct impact on: 

  • Maintainability 
  • Software stability 
  • Security  

When any of these areas are compromised, your software can go from being a functioning product with high returns to a resource sinkhole. 

Good Code vs. Bad Code  

Developers tend to have a more nuanced perspective making it difficult to pin down what makes objectively code better or worse. Fortunately, there are some key characteristics that determine code quality.  

GOOD CODE 

BAD CODE 

Does what it says it should 

Doesn’t function reliably 

Simple and clean (is not cluttered or difficult to navigate) 

Needlessly complex 

Concise (uses only as many lines of code as necessary) 

Verbose (uses more lines of code to achieve functionality) 

Readable (not just by the author) 

Difficult to read for users and other devs 

Testable (supports unit and integration tests down to the smallest components) 

Not easily testable  

Maintainable by other devs 

Difficult to maintain for other devs 

Can be reused in other applications  

Doesn’t work well in other contexts/circumstances 

Extensible (can easily add new functionalities or features) 

New additions run the risk of breaking existing functionality 

Well documented 

Poorly documented 

 

Keeping the above characteristics in mind can ensure that code is consistent and more stable. While what makes code readable or easy to navigate can depend on individual preferences, it’s always good practice to adhere to a coding standard or a team style guide. 

Common metrics for tracking code quality  

Code quality can be hard to identify relying solely on human reporting. Fortunately, it is possible to derive quantitative measures from code produced throughout the development process. The following are commonly used metrics.  

Complexity  

As applications become larger and the number of contributing developers increases, it’s natural that software products become more complex. However, on an individual basis, complexity is a good way to track code quality across development teams. The following methods are commonly used to measure code complexity in software.   

Halstead Complexity is based on measurable qualities of software code. It’s typically calculated using Halstead metrics like: 

  • Program Length 
  • Vocabulary 
  • Volume 
  • Potential Minimal Volume 
  • Program Level 
  • Program Difficulty 
  • Programming Effort 
  • Language Level 
  • Intelligence Content 
  • Programming Time  

Cyclomatic Complexity measures complexity differently. In this method, the control-flow options of a section of code are used to determine complexity. The more logical paths that a piece of code can branch into, the more complex it is.   

Cognitive Complexity is like Cyclomatic Complexity but calculates complexity using slightly different values for the linearly independent paths that the code can branch into.  

Bugs per Line of Code  

One of the simpler measures for code quality is the number of bugs per line of code. Typically, bug detection is part of testing carried out in development and quality assurance. If a developer produces one hundred lines of code, which results in two bugs, their code has an error rate of 2%.   

Code that executes with minimal errors is generally more stable and, therefore, of better quality than code with higher error rates. As the complexity of code increases, however, there is a tendency for error rates to increase as well. 

Code quality and your bottom line  

Having consistent code quality can make your development efforts more efficient. Higher-quality code can reduce code churn, product downtime, and maintenance costs. The result is more reliable software that delivers value to customers consistently. The more productive your development process, the better your ROI. Learn more about tracking productivity in your development teams here. 

New call-to-action

About the author
Juan Pablo González

Working as Foreworth’s Chief Technical Officer, Juan Pablo (JP) manages the company’s technical strategy. With nearly 20 years of experience in software development, he ensures the development process at Foreworth is meeting its keys objectives and technical requirements.

More info →

What do you think? Leave us your comments here!