From "Fundamentals of Software Architecture"
🎧 Listen to Summary
Free 10-min PreviewAutomated Architectural Governance with Fitness Functions
Key Insight
Architects bear the responsibility of governance, ensuring that defined architecture characteristics, particularly those that are 'important but not urgent' like modularity, are maintained by development teams. Traditional oversight methods like code reviews often occur too late, allowing significant architectural degradation before intervention. The evolution of software development practices, from Extreme Programming to DevOps, has paved the way for more sophisticated, automated solutions for architectural governance. This continues through to architectural governance. A family of techniques called fitness functions are used to automate many aspects of architecture governance; this concept draws from principles in evolutionary computing, where an objective measure assesses an outcome's quality.
An architecture fitness function is defined as 'any mechanism that provides an objective integrity assessment of some architecture characteristic or combination of architecture characteristics.' These functions are not new frameworks but rather a novel perspective on existing verification tools, overlapping with metrics, monitors, unit testing libraries, and chaos engineering. For example, to prevent the damaging 'Big Ball of Mud' anti-pattern caused by uncontrolled component interdependencies, architects can implement fitness functions using tools like JDepend for Java. This tool can be integrated into a continuous build pipeline to automatically fail the build if cyclic dependencies between packages are detected, effectively guarding modularity without constant manual oversight. Similarly, JDepend can verify the 'distance from the main sequence' metric by establishing acceptable thresholds for class values.
Specialized tools like ArchUnit for Java and NetArchTest for .NET provide predefined governance rules codified as unit tests, enabling architects to enforce structural principles like layered architectures. For instance, ArchUnit can verify that service layers are only accessed by controller layers, preventing developers from unintentionally or intentionally bypassing architectural constraints. Beyond static code analysis, Netflix’s Simian Army exemplifies dynamic fitness functions in production environments. The Conformity Monkey enforces governance rules, such as ensuring all services respond to RESTful verbs. The Security Monkey actively checks for known security defects like open ports, and the Janitor Monkey identifies and terminates orphaned services to manage cloud resource consumption. These tools, rooted in 'chaos engineering'—the discipline of anticipating system failures—act as automated checklists, codifying important architectural principles into the system’s infrastructure to enhance robustness and maintain quality, preventing details from slipping by in highly complex work.
📚 Continue Your Learning Journey — No Payment Required
Access the complete Fundamentals of Software Architecture summary with audio narration, key takeaways, and actionable insights from Mark Richards, Neal Ford.