DEV Community

loading...
Cover image for How to Track Your Technical Debt
Code Inspector

How to Track Your Technical Debt

Julien
Founder of Code Inspector, former Twitter Staff, former AWS, CMU-SEI alum, former European Space Agency engineer
・4 min read

Technical debt is a plague that spreads on your software over time. In this post, we explain what is the technical debt issue, how to fix it, and how our new platform, Code Inspector helps software developers and technical managers to address it.

The Technical Debt Problem

Technical debt is plaguing almost every project. The story often follows the same path: we start writing code, delivering a project and as new features, bug fixes, and architectural changes are taking place, because of the need to be delivered under stringent time constraints, developers take shortcuts to quickly deliver a product. We forget to write tests, copy/paste blocks of code instead of writing functions, do not put any comments, and do not follow coding style altogether. This is not a single violation of good coding practices that deteriorate the status of a project, this is the accumulation of these small problems that, over time, make the maintenance of the project unsustainable.

As new features need to be shipped, we often pile more debt. As software maintenance is becoming really hard, we end up dedicating weeks to fix issues, blocking development, and other bug fixes. Some people decide to re-write everything from scratch, which is, as history tells us, often a bad idea.

How to Manage and Reduce Technical Debt?

As Peter Drucker said, “If you can’t measure it, you can’t improve it”. It is necessary to be able to measure your technical debt and get metrics on your code quality. Once you have baseline numbers, you can start improving.

Use of Static Analyzers

Static analyzers are programs that check your code’s correctness according to pre-defined rules. They will look for various issues, from compliance of coding standards to potential security issues.

There’s a lot of existing static code analysis tools available on the market for almost any language. It certainly takes some time to install and configure them but these tools will show coding errors that are likely to impact you in the future.

Unfortunately, there is no silver bullet. First of all, these tools will surface issues at various severity levels and you need to sort what is important and critical to fixing from minor issues (such as pure non-critical syntax issues). In addition, some tools will report non-issues (false positives). That makes their use more complicated as well.

Detection of code duplicates

Code duplicates constitute a big part of a project’s technical debt. Many programmers try to save time by simply copy/paste a block of code rather than creating a function. As a result, when this block contains a bug, it needs to be updated in multiple places and it is common to see the fix be applied only in one place.
This is a good practice to detect code duplicates in a project, chase them and attempt to refactor the code. This re-architecture effort takes time but will not only pay off in terms of quality (a bug fix on the function will benefit all the callers) but also will make the codebase easier to understand.

Monitor Code Metrics

Code analysis tools provide you a list of violations and duplicates for your codebase and it is crucial to monitor these metrics closely to see trends in your project. Tracking these metrics will tell you if your project is actually improving (fewer issues/duplicates over time?) or not.

Code Inspector to the rescue

Code Inspector is a new platform targeted to software developers and managers to tackle and fix their technical debt. The analysis engine combines and aggregates analyses from a selection of best static analyzers for the most popular languages and keeps track of these metrics over time. It also filters false positives based on code analysis and user feedback, removing false positives from reports. The platform archives code quality metrics under a dashboard that shows the evolution of code quality metrics over time.
The engine distinguishes violations per severity (a range from 1 (very critical) to 4 (non-critical) and category (such as security, safety, design). You can then keep track of their evolution according to their severity or category.

Alt Text

The very same dashboard is also available to keep track of duplicates and keep an aggregate of the number of duplicates as well as their total number.

Alt Text

The tool also surfaces hot spots in the code base, modules (files or directories) that have an unusually high number of violations or duplicates. These hot spots are likely where most of the re-work needs to be done.

We believe that to improve your project, you need to have reliable metrics that act as indicators of your project quality. Once you have these numbers, you can start modifying and refactoring your code and see how these quality metrics improve over time.

Want to start improving your project today? Sign up at [Code-Inspector](https://www.code-inspector.com] for free, start tracking your codebase and get recommendations to fix it. You can also join our Slack community by using this invitation link.

Discussion (0)