Acyclic Dependencies Principle

No Change
adopt
First Added:June 25, 2026 Updated: July 2, 2026

Acyclic Dependencies Principle is a technique we adopt in the garden.

Summary

When to use: Evaluate on a project when the capability clearly fits the requirement.

When to skip: When a simpler alternative already covers the need.

Details

Component Coupling Context

ADP is one of three classic component coupling principles (Robert C. Martin). Siblings are Stable Dependencies Principle (SDP) and Stable Abstractions Principle (SAP).

PrincipleGist
ADPNo cycles in the component graph
SDPDepend toward more stable components (Stable Dependencies Principle)
SAPStable components stay abstract (Stable Abstractions Principle)

Breaking Cycles (Practical)

TechniqueWhen it fits
Extract shared interface to a third packageTwo modules need each other’s types
Dependency Inversion Principle (preferred)High-level module should not depend on low-level detail; extract shared interface
Event or message boundaryRuntime decoupling when compile-time inversion is awkward
Merge componentsCycle means the split was wrong; reunify

Practical Signs

SignalLikely fix
Build order only works with hacks or --forceMap imports; break the smallest back-edge
common imports from features and vice versaInvert dependency or extract shared kernel
Microservices call each other synchronously in a ringIntroduce events or consolidate ownership
Refactor blocked because “everything depends on everything”ADP review before more features

Common Failure Modes

  • Ignoring test-only or devDependency cycles that mirror production cycles
  • Breaking a cycle by moving code to a junk-drawer shared package (creates a god module)
  • Layer rules on paper while code imports whatever is convenient
  • Splitting services without removing synchronous call loops

Related Garden Items