Architecture Fitness Functions
frontend -> application -> domain -> infrastructure, and fail if domain
-> infrastructure. A sensor of architectural drift.
Architecture fitness functions are executable assertions about the structure of the code. They fail when the architecture violates a rule: a domain layer importing infrastructure, a service bypassing its API, a forbidden dependency forming. They turn architectural rules from prose into computational gates.
Sensor properties
| Property | Value |
|---|---|
| Oracle strength | High — a violation is definitive |
| Independence | High — rules are external to the code |
| Scope | System-level |
| Feedback latency | Seconds |
| Actionability | Guiding — shows which rule was violated and where |
| Type | Predictive |
What it cannot detect
Fitness functions only check rules you’ve codified. Implicit architectural rules that haven’t been expressed as functions are invisible to this sensor.