Finding a Dependency Against Stability

An online shop is split into modules. An arrow from one module to another means the first depends on the second, and each pair counts as one dependency. The dependencies are:

  • Checkout depends on Domain and Billing.
  • Admin depends on Domain and Billing.
  • Billing depends on Domain and EmailSender.
  • Domain depends on EmailSender.
  • EmailSender depends on SmtpClient and Templates.
  • SmtpClient and Templates depend on no other module.


A dependency graph with arrows from Checkout and Admin to Domain and Billing, from Billing to Domain and EmailSender, from Domain to EmailSender, and from EmailSender to SmtpClient and Templates.


For a module, the afferent coupling CaC_a is the number of other modules that depend on it, the efferent coupling CeC_e is the number of modules it depends on, and its instability is


I=CeCa+CeI = \frac{C_e}{C_a + C_e}


The Stable Dependencies Principle says a module should depend only on modules whose II is no greater than its own. Complete the table, writing II as an exact decimal such as 0.5, and answer yes or no in the last column.

ModuleCaCeIDepends on a module with strictly higher I
Checkout
Billing
Domain
EmailSender

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Design Principles Questions: