A problem with metric-driven development

There's an approach to software development that requires every piece of engineering work to be justified against a metric that it will move. Before committing to a piece of work, you need to identify the metric, articulate how the work will influence it, and ideally quantify the expected improvement.

On the face of it, this seems quite reasonable. Engineering time is a finite resource, and organisations should be making considered decisions about where to invest it. Having objective measures against which to evaluate the effectiveness of those investments is generally a good thing.

Where I think this becomes problematic is when the ability to demonstrate a measurable improvement becomes a prerequisite for doing the work in the first place.

In his 2018 book, The Tyranny of Metrics, Jerry Z. Muller describes the tendency for organisations to substitute quantitative measures for professional judgment, a phenomenon he refers to as metric fixation.

Whilst much of Muller's discussion concerns the use of metrics to evaluate performance, I think there's an equally interesting problem in software engineering: the use of metrics to determine which work is worth undertaking in the first place. The consequences of this extend beyond how we measure the effectiveness of engineering to how we shape the evolution of software systems.

Not everything of value is readily measurable

A considerable amount of good software engineering involves making decisions whose value will only become apparent over time.

Removing an unnecessary abstraction, establishing clearer boundaries between components, consolidating duplicated implementations, or simplifying how a system is deployed are all examples of work that might have relatively little immediate impact on any of the metrics an organisation cares about.

The value of this work is often realised in the subsequent work that takes place on the system. Changes become easier to make, engineers can reason about the system more readily, and entire classes of problems cease to exist.

How would you accurately quantify the value of a class of bugs that can no longer be introduced as a consequence of a design decision?

You could introduce proxy metrics for some of these things, but at some point you're spending engineering time trying to measure something for which you already have a fairly sound engineering rationale.

Optimising for local maxima

Metric-driven development disproportionately favours exploiting known opportunities rather than exploring new ones.

Exploitation stops at a local optimum; exploration crosses a valley to reach a higher optimum.
Exploitation stops at a local optimum; exploration can accept a temporary setback to reach a better outcome.

Consider a team responsible for a search system with a goal of reducing search latency. There are likely to be a number of relatively well-understood opportunities to improve latency within the existing architecture: introducing a cache, reducing allocations, parallelising operations, tuning thread pools, and so on.

Each of these can be investigated in isolation, an expected improvement can be estimated, and the results can be measured.

Now consider a more fundamental change to the architecture of the search system. It might require several months of work, during which none of the individual changes materially improve search latency. Some might even temporarily make it worse. The eventual architecture, however, might have substantially better performance characteristics and be capable of supporting workloads that the existing architecture cannot.

If every piece of work needs to independently demonstrate an improvement to search latency, the former approach will almost always be easier to justify.

Over a sufficiently long period of time, an organisation can become very effective at optimising an architecture that it ought to be moving away from.

The compounding value of engineering

Something that I think is generally underappreciated in software development is the compounding effect of good engineering decisions.

The architecture of a system, the quality of its abstractions, the tooling available to engineers, and the consistency with which common problems are solved all influence the cost of developing software in the future.

A well-designed shared library might save each engineer only a small amount of time on any given piece of work. Across hundreds of engineers and thousands of changes over several years, that saving can be substantial. It might also improve consistency, reduce operational overhead, and make it considerably easier to introduce changes across an organisation.

Attributing that value to a single metric is difficult, particularly at the point at which the decision to build the library needs to be made.

Good engineering creates leverage. Some of the highest-leverage work is the work that makes subsequent work cheaper, safer and easier to undertake.

The inverse is also true. Poor engineering decisions compound, increasing the cost of every subsequent change. An organisation can be making consistent progress against all of its chosen metrics whilst the underlying software becomes progressively more difficult and expensive to develop.

By the time this manifests in a metric that warrants attention, addressing it is often a considerably larger undertaking.

Metrics shape behaviour

When a measure becomes a target, it ceases to be a good measure.

The metrics an organisation chooses to prioritise will inevitably influence the decisions that engineers make, both technically and culturally.

If improving a particular latency percentile is a goal, engineers will naturally gravitate towards work that influences that percentile. Whether that work represents the best investment of engineering time across the system as a whole is a different question.

Similarly, if reducing infrastructure costs is a goal, there may be a number of opportunities to achieve this at the expense of increased software complexity, operational risk or developer productivity. The infrastructure savings are relatively straightforward to quantify. The costs introduced elsewhere in the system are often less so.

Metrics are necessarily a lossy representation of the things we care about. There are interactions between different aspects of a system that are difficult to capture, and consequences of decisions that may not manifest for some time.

Adding more metrics doesn't necessarily solve this problem.

The cost of things that don't happen

A particularly difficult category of work to justify in a metric-driven environment is preventative engineering.

Replacing a fragile implementation, addressing an architectural limitation ahead of anticipated growth, or removing an unnecessary dependency might prevent a significant production incident in the future.

If the work is successful, the incident never happens. Conversely, if the work isn't undertaken and an incident does occur, there is suddenly a wealth of supporting data with which to justify the very same work.

This creates a somewhat perverse incentive to address problems reactively. Organisations can end up requiring evidence of a problem that experienced engineers were quite capable of identifying before it occurred.

The cost of exploration

There's also an assumption implicit in metric-driven development that we know enough about a problem and its potential solutions to reasonably articulate the outcome of a piece of work before undertaking it. This is frequently not the case.

Some of the more interesting engineering work involves investigating whether a different approach to a problem is viable. It might involve prototyping an alternative architecture, experimenting with a different algorithm, or investigating whether a technology has properties that would be advantageous to the system.

The outcome of this work is knowledge that can be used to inform subsequent decisions. Sometimes the most valuable outcome is discovering that an approach isn't worth pursuing.

An organisation that requires a quantifiable return on engineering work before undertaking it is likely to underinvest in this type of exploration. It will naturally favour smaller, more predictable improvements to existing solutions.

The illusion of rigour

Requiring every piece of work to be associated with a metric doesn't necessarily result in more rigorous engineering decisions.

Engineers are quite capable of constructing a plausible narrative that connects almost any piece of work to an organisational metric. With sufficient indirection, most engineering work can probably be attributed to developer productivity, reliability, customer satisfaction or cost.

The further removed the work is from the metric, however, the more speculative that relationship becomes.

When this is a requirement for getting work prioritised, there's an incentive to present speculative estimates with a degree of confidence that isn't warranted. The process can give the appearance of data-driven decision-making whilst in practice being little more than a justification exercise.

I'd much rather have engineers articulate the rationale for a piece of work, acknowledge the uncertainties, and have a meaningful discussion about its relative merits.

Metric-informed development

I think there's an important distinction between using metrics to inform engineering decisions and using metrics to dictate which engineering decisions can be made.

Metrics are extremely useful for identifying problems, understanding the characteristics of a system, establishing priorities and evaluating the effectiveness of changes. Where it is practical to measure the outcome of a piece of work, we absolutely should.

There are, however, other perfectly reasonable ways to justify an engineering investment:

  • Reducing the complexity of a system.
  • Reducing the cost and risk of future changes.
  • Addressing known or anticipated architectural limitations.
  • Removing constraints on what can be built.
  • Improving the consistency with which common problems are solved.
  • Acquiring knowledge to inform future engineering decisions.

I'd argue that metrics are often better applied at the level of a team's overall investment in a problem space, rather than at the granularity of every individual piece of work undertaken by that team.

This gives engineers the latitude to make the foundational and intermediate changes necessary to achieve an outcome, without having to contrive an independently measurable improvement for each of them.

It also requires organisations to place some degree of trust in the experience and judgment of their engineers. Part of the value of experienced engineers is their ability to recognise problems, anticipate the consequences of decisions, and identify opportunities that aren't yet apparent in the data.

Every piece of engineering work should have a sound rationale. It doesn't follow that every piece of engineering work needs to move a metric. Some of the most valuable engineering decisions we make are those that change what is possible in the future, rather than improve what we happen to be measuring today.


Share this article

Comments

Type to search. Use the arrow keys to browse results and Escape to close.