Modularity

Subpage of Agentic Coding

Software quality depends heavily on deep modules: modules with simple interfaces that hide substantial internal complexity.

Eric Evans’, Domain-Driven Design communicates this idea as follows:

  • modules should "tell the story of the system"
  • decomposition should follow "conceptual contours"

This is where locality matters. Related code should live together. Unrelated code should not be mixed merely because it shares a framework layer.

Fix 1: Design Modules by Responsibility

This is a similar idea as in OOP. Every module should only be responsible for one thing and it should encapsulate everything needed for that one thing.

This allows good separation of concerns. We should ensure that separation of concerns in build intrinsically into the code generated by the agent.

Fix 2: Prefer Deep Modules

Deep module have a small, precise description of the task they do but extensive code that implements this. This allows us to abstract away a lot of detail and thus achieve good compartmentalization.

Fix 3: Make Public Interfaces Smaller

We need to make interface first modules.