Mark Richards Unveils ADL's Power in Governing Architectural Constraints

In a recent “Software Architecture Monday” lesson, Mark Richards delved into the critical topic of governing architectural constraints, building upon his prior discussions on Architecture as Code (lesson 194) and the Architecture Definition Language (ADL) (lesson 210). ADL, a pseudo-code language co-developed with Neil Ford, serves as a powerful tool to both describe and govern software architectures by generating executable source code from architectural descriptions. Richards presented a real-world scenario characterized by a tight budget, limited timeframe, and anticipated frequent changes to underlying data structures. This scenario led to the selection of a layered architecture—a “modular monolith”—due to its cost-effectiveness, simplicity, and superior separation of concerns, particularly for database change control.

To ensure the chosen layered architecture’s success, specific architectural constraints were identified: presentation, business, and services layers must not directly interact with the database, and all database logic must exclusively reside within the persistence layer. Richards demonstrated how ADL can be employed not only to describe these constraints but also to enforce them rigorously. By feeding the ADL description into GenAI, executable architecture tests can be automatically generated for various programming languages, including ArchUnit for Java, ArchUnit.NET for C#, Piest-Arch for Python, and Go-C for Go. These generated tests, for instance, in ArchUnit, assert that “no classes that reside outside of a persistence package should depend on classes that are assignable to a connection object, statement, prepared statement, or result set.” This innovative approach leverages ADL to create a living, executable governance mechanism, ensuring continuous architectural alignment and preventing constraint violations as the codebase evolves.