Code quality and technical debt

Architecture fitness function

Also known as Architecture fitness function, Architecture fitness function in software engineering

By WeavePublished 1 min read

Definition

An automated or repeatable check that tests whether an architecture continues to meet a chosen constraint.

What it means

An architecture fitness function turns a qualitative architectural rule into an observable check. Examples include preventing forbidden dependencies, enforcing API compatibility, or limiting a service’s coupling. The function should state the boundary, evidence, threshold, and response when it fails.

Example

A platform rule forbids domain modules from importing infrastructure adapters. CI checks the dependency graph and blocks new violations, while existing exceptions are tracked separately for repayment.

Limitations

A fitness function can encode the wrong rule, become brittle during legitimate evolution, or measure structure without behavior. Review the constraint with architects and owners, and provide an exception path with expiry.

How to use the signal

Keep failures actionable by linking each rule to the architectural property it protects and the owner who reviews exceptions.

Weave can help show whether fitness-function failures produce timely fixes or recurring review friction. Keep enforcement in CI or architecture tooling, then use Weave to inspect the work pattern.

How this relates to Weave

Weave can help show whether fitness-function failures produce timely fixes or recurring review friction. Keep enforcement in CI or architecture tooling, then use Weave to inspect the work pattern.

Explore Engineering intelligence

Sources and further reading

  1. SonarSource code metrics and analysis documentation