Software: In the red

In the second in his series of four articles, Niroshan Rajadurai from Vector Software asks what is technical debt and where can it found
Embedded software is booming and the race is on to develop software faster than ever while maintaining high quality standards, as well as ensuring compliance with industry safety regulations. However, the pressure constantly to churn out new software versions for new models, going back to the drawing board and writing code from scratch simply isn’t viable. Therefore, the software used in cars today already has a varying degree of technical debt.
Technical debt is a metaphor for latent defects introduced during system architecture, system design or system development. First coined by Ward Cunningham in 1992, technical debt refers to the accumulated liability created when organisations take design and test shortcuts to meet short-term goals.
Since the late 1970s, car brands have not only used platform sharing concepts for hardware, but also a proportion of the software for controlling key systems – such as ABS, engine management and infotainment – has evolved from these origins.
Let’s add to the equation the use of code from third-party suppliers, either because of outsourcing for projects that required highly specialised programmers or from buying-in specialised components. As with any integrated system, there are compromises to be made when introducing code from external sources, as there will always be a degree of uncertainty about the quality of the code developed.
Skip forward to today, the automotive industry has seen an unprecedented increase in the integration of new advanced driver assistance systems (adas), such as navigation and vision assisted parking, onto the code base. These features were originally add-on packages, and some were dealer fitted options. Therefore, while designed to function as driver aids to improve safety, they were not considered critical components for the safe operation of the car.
With the advent of connected car concepts that focus on delivering a holistic safe environment for occupants, adas features and their associated software have to be integrated with the safety, engine management, infotainment and other systems via the vehicle bus. All this system integration adds to the system’s complexity and the likelihood of software incompatibilities and, in turn, an increase in the overall technical debt.
The pressure to get to market and cost considerations are part of the reason why so-called legacy code is often used. This pressure brings many trade-offs and short cuts in design, development and testing that have subsequently introduced defects in the software that make its use a high risk behaviour that is not entirely predictable. This technical debt needs to be evaluated as it will affect the quality of the end product.
The size of the debt needs to be known before it can start to be paid down.
The ideal is to refactor the legacy code; however, to do this an understanding is needed of the functional requirements of the software. Many times this information is no longer available. Therefore, it can be difficult to write a unit test to understand how a particular piece of legacy code works because it often contains embedded dependencies on other components, which are hard or impossible to initialise in a unit testing context.
There needs to be a way to make the scale of the technical debt clearly visible to solve the problem. Unit and integration testing is essential with any code but when working with legacy code, this type of testing is more complicated.
Rather than looking for an easy way out, software engineers and manufacturers must design and adopt new development processes, which ensure that no new debt is added and existing debt is paid down. There are various ways to do this, but they all require the following steps:
- • Understand the problem by capturing key metrics such as code complexity, comment density and API complexity;
- • Share the results by publishing the data to all stakeholders; and
- • Plan for improvement by focusing effort on the outliers such as splitting functions with the highest complexity.
To continue developing the volume of software that modern cars require, companies must develop scalable development processes that lead to robust and maintainable code bases relatively free of technical debt.
How does one achieve a common understanding of the amount debt?
The first step is to establish the level of technical debt by gathering metrics and capturing test results that provide insight into the scale of the problem.
To understand these data, companies need to establish a comprehensive and common set of metrics and thresholds for what debt free means and an automated way to capture and report these metrics. This process will establish a where-we-are baseline.
Because software components tend to be developed over time in different locations and by different teams, it is very likely that the baseline metrics will vary dramatically across a code base.
While static analysis can provide some of the debt metrics, it does not measure testing completeness, and as a result does not help determine correctness.
Measuring testing completeness is a key component of understanding the scale of technical debt. Completeness is most easily measured with code coverage analysis, which records the percentage of executable statements and branch outcomes that have been executed by a test case.
Once code complexity and documentation deficiencies have been reduced, it’s time to tackle the biggest source of technical debt: inadequate testing. Much like metric thresholds, the first step is to decide what adequate testing means to the organisation.
To be adequate, tests need to prove two things: correctness – the application works as intended; and robustness – that out-of-range conditions are well handled.
In conclusion, capturing key metrics during the test process presents a unique opportunity to understand fully the level of technical debt and risks throughout a business’s code base. A clear action plan can then be developed to pay down the debt.
Niroshan Rajadurai is director of EMEA for Vector Software
