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
| Characteristic | Fitness function | Tool examples |
|---|---|---|
| Modularity | No imports of another module's internals; no cycles | ArchUnit, dependency-cruiser, deptrac, import-linter |
| Performance | p95 latency and throughput thresholds | k6, Gatling, Locust in CI |
| Security | No critical CVEs; no secrets committed | Trivy, npm audit, Dependabot, gitleaks |
| Resilience | Service survives dependency failure | Chaos experiments (Toxiproxy, Chaos Mesh) |
| API compatibility | No breaking changes to published contracts | oasdiff, buf breaking, Pact |
| Cost | Infra cost per request under budget | Cloud cost reports with alerts |
Building fitness functions
- Identify the architectural characteristics that matter most
- Express each as an objective, measurable check
- Automate it in CI (atomic) or in production monitoring (holistic)
- Fail fast on violations; make results visible
- Revise thresholds and add functions as drivers change
Fitness functions in the 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.accountsBreaking API change check
Compare the OpenAPI spec against main in CI.
oasdiff breaking openapi-main.yaml openapi.yaml --fail-on ERRCommon 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.