Evolutionary Architecture and Fitness Functions

Evolutionary architecture explained: guided incremental change, and fitness functions that test architecture automatically in CI.

Published November 27, 2026

Requirements change, traffic grows, teams reorganise and new technology arrives. An architecture designed once and frozen will drift or break. Evolutionary architecture, a term popularised by Neal Ford, Rebecca Parsons and Patrick Kua, treats architecture as something that changes continuously in small steps, with automated checks called fitness functions keeping it on course.

The concept

A fitness function is any objective, automated check of an architectural characteristic. If you care that modules do not depend on each other's internals, a test enforces it. If you care that the checkout API stays under 300 ms at p95, a load test in the pipeline enforces it. If you care that no dependency has a critical vulnerability, a scanner enforces it. Each check turns an architectural intention into something the build can verify.

Together, fitness functions make change safe. Teams can refactor, upgrade libraries or extract modules quickly because the pipeline tells them immediately if a key quality has degraded. This shifts architecture governance from review meetings and documents to fast, objective feedback, which scales much better as the number of teams grows.

Examples of fitness functions

CharacteristicFitness functionTool examples
ModularityNo imports of another module's internals; no cyclesArchUnit, dependency-cruiser, deptrac, import-linter
Performancep95 latency and throughput thresholdsk6, Gatling, Locust in CI
SecurityNo critical CVEs; no secrets committedTrivy, npm audit, Dependabot, gitleaks
ResilienceService survives dependency failureChaos experiments (Toxiproxy, Chaos Mesh)
API compatibilityNo breaking changes to published contractsoasdiff, buf breaking, Pact
CostInfra cost per request under budgetCloud cost reports with alerts

Building fitness functions

  1. Identify the architectural characteristics that matter most
  2. Express each as an objective, measurable check
  3. Automate it in CI (atomic) or in production monitoring (holistic)
  4. Fail fast on violations; make results visible
  5. Revise thresholds and add functions as drivers change
Turning architectural goals into automated guardrails.

Fitness functions in the pipeline

CIgategatereleaseCommitUnit + arch testsmodularityContract + securityAPIs, CVEsPerf testp95 < 300 msDeploymonitor SLOs
Fitness functions as stages of the delivery pipeline.

Atomic vs holistic, triggered vs continuous

An atomic fitness function checks one characteristic in isolation (a dependency rule). A holistic one checks interacting characteristics together (latency under load while a dependency is slow). Triggered functions run on events such as commits; continuous ones run all the time in production, such as SLO monitoring. A healthy system has a mix: fast atomic checks on every commit and holistic checks in staging and production.

Practical examples

ArchUnit rule (Java)

Fail the build if the domain depends on infrastructure.

@ArchTest
static final ArchRule domainIsIndependent =
    noClasses().that().resideInAPackage("..domain..")
        .should().dependOnClassesThat().resideInAnyPackage("..infrastructure..", "org.springframework..");

import-linter contract (Python)

Declare layers and module independence in config.

[importlinter]
root_package = shop

[importlinter:contract:modules]
name = Modules are independent
type = independence
modules =
    shop.catalog
    shop.checkout
    shop.accounts

Breaking API change check

Compare the OpenAPI spec against main in CI.

oasdiff breaking openapi-main.yaml openapi.yaml --fail-on ERR

Common mistakes

  • Fitness functions nobody looks at because failures do not block anything.
  • Thresholds so loose they never fail, or so tight they fail randomly and get ignored.
  • Only atomic checks, missing qualities that emerge under load or failure.
  • Treating fitness functions as a one-off project instead of evolving them.
  • Encoding opinions that are not real requirements, creating friction without value.

Key takeaways

  • Evolutionary architecture embraces continuous, incremental change.
  • Fitness functions are automated checks of architectural characteristics.
  • Put fast atomic checks in CI and holistic checks in staging and production.
  • They replace slow review gates with objective, scalable feedback.

FAQ

Are fitness functions just tests?

Many are implemented as tests, but they target architectural qualities (modularity, latency, security) rather than business behaviour.

Where does the term come from?

It is borrowed from evolutionary computing, where a fitness function measures how close a candidate solution is to the goal. The book Building Evolutionary Architectures applies it to software.

How many fitness functions should we have?

Start with three to five covering your top quality attributes, and add more when a recurring problem shows a gap.

More Architecture articles