Fitness Functions
An architectural fitness function is an objective, preferably automated, test of how well a system meets an architectural characteristic such as performance, security, resilience, cost or modularity.
The term comes from Building Evolutionary Architectures by Neal Ford, Rebecca Parsons and Patrick Kua. The idea is simple: if architecture is about the qualities a system must have, and the system is going to keep changing, then those qualities need checking continuously, not once at a design review.
Verification beats specification. Express non-functional requirements as tests wherever you can.
A requirement like “the system must be fast” is an aspiration. “95% of order queries return in under 300ms at 200 requests per second” is a test. Writing non-functional requirements as acceptance criteria and checks turns them from wishes into something you can actually prove, release after release.
Examples
| Characteristic | Fitness function |
|---|---|
| Performance | Load test in CI: p95 latency stays under the budget for the key end-to-end scenarios |
| Modularity | Dependency rules enforced by a test, for example “the domain layer must not import the web framework” |
| Security | No critical vulnerabilities in dependencies; no public storage buckets; no wildcard IAM policies, checked by policy as code |
| Resilience | Service keeps meeting its SLO with one availability zone removed in a chaos experiment |
| Cost | Estimated monthly cost of a change stays within budget; cost per transaction doesn’t regress |
| Operability | Every service emits traces and has an SLO and a runbook |
| Recoverability | A scheduled restore from backup completes within the RTO |
Some fitness functions are atomic (one characteristic, checked in isolation, such as a dependency rule) and some are holistic (several characteristics together, such as a chaos experiment under load). Some run on every change; others run continuously against production.
Fitness functions and the Definition of Done
“Done” is never a single state. A change can be developed but not tested, tested but not integrated, integrated but not accepted by users, and in production but not yet delivering the value it was for. We recommend a stack of Definitions of Done, with each level proving more than the last:
- Developed and unit tested
- System tested against its acceptance criteria
- Integration tested across the services and teams involved
- User accepted by real users or their genuine representatives
- Live in production, observed and supported
- Value achieved: the outcome it was built for is measurably happening
Fitness functions belong at each level: fast, atomic checks at the bottom, and holistic checks against real environments higher up. Push every change as far up the stack as it can practically go, as often as possible, rather than saving the expensive checks for a big release.
Where to start
Don’t try to automate every quality on day one. Use the architectural profile to find the dimensions with the highest complexity or risk, and write fitness functions for those first. A handful of meaningful checks that always run is worth far more than a comprehensive suite that’s always broken.
Fitness functions also make it safe to let others (new teams, suppliers and, increasingly, AI agents) change the system. If the qualities you care about are checked automatically, you can accept change from anyone who passes the checks.