Dave Farley advocates for using executable specifications and acceptance test-driven development (ATDD) as the essential method for generating reliable AI-assisted code, emphasizing that precise, verifiable tests define the intended behavior and serve as a contract that AI-generated code must satisfy. He critiques current markdown-based specs for their lack of rigor and proposes a layered testing architecture that enables iterative, controlled development where AI can innovate within strict, automated constraints, ensuring confidence and correctness in the final software.
In this video, Dave Farley discusses the evolving landscape of AI-assisted software development, emphasizing a growing consensus among industry experts that the future lies in executable specifications rather than vague prompts or static documents. He highlights that while AI can rapidly generate code, the critical challenge remains in precisely specifying what the software should do and verifying that it meets those requirements. This approach, rooted in acceptance test-driven development (ATDD), involves writing executable tests that define the system’s intended behavior, ensuring that any code—whether human or AI-generated—can be validated against these clear, automated criteria.
Farley references several thought leaders, including Bob Martin, Adam Tornhill, Kent Beck, and others, who advocate surrounding AI agents with rigorous constraints such as unit tests, behavioral specifications, and quality metrics. These constraints serve as the “contract” that AI must satisfy, preventing it from drifting away from the intended functionality. He stresses that the specification must be executable and verifiable, not just a descriptive markdown document, because only then can developers be confident that the AI-generated code truly fulfills the desired behavior.
The video also critiques current industry tools and approaches, noting that many rely on markdown-based specs that lack the necessary formality and detail, leading to discrepancies between the specification and the actual code. Farley argues that the specification and its validation should be unified into a single artifact—executable tests written in the language of the problem domain. This ensures that the specification remains accurate and relevant, as any deviation causes tests to fail immediately, signaling that the system no longer meets its intended behavior.
Farley outlines a four-layer testing architecture that supports this approach: at the top are domain-specific test cases written in the language of the problem domain; beneath that, a domain-specific language (DSL) layer simplifies test writing; below that, protocol drivers interface with the actual system; and at the bottom lies the system under test. This separation of concerns allows the underlying implementation to change freely without breaking the specification, providing AI agents with the freedom to innovate while adhering strictly to the defined intent.
Finally, Farley offers practical advice for working effectively with AI coding agents: write the specification before coding begins, proceed one scenario at a time, watch tests fail before making them pass, and keep specifications protected from AI edits to maintain their integrity. He emphasizes that this method is not a regression to waterfall development but an iterative, incremental process that scales well even for complex systems. By adopting executable specifications and acceptance test-driven development, developers can harness AI’s power while maintaining control and confidence in the software they produce.
Useful Links
- Spec Kit by GitHub - Spec-Driven Development Tool — Materially discussed as an example of current spec-driven tools and their challenges with markdown specs.
- Four-Layer Testing Architecture Model for Executable Specifications — Central to the video’s explanation of how to structure tests and specifications for AI-assisted development.