Checking access and cycles together

A checkout application enforces two rules for its module boundaries:

  • A call from another module may access only an exported operation, meaning an operation included in the target module's public interface.
  • The dependency graph may contain no dependency cycle: a sequence of directed dependencies that returns to its starting module.

The diagram shows all initial dependencies. They satisfy both rules. Each proposed call adds a dependency from its caller to the module containing the called operation; all initial dependencies remain.


The initial module graph shows Display depending on Checkout, with branches through Pricing and Store.


The following access declarations apply:


Module

Operation

Access

Pricing

quote

Exported

Store

save

Exported

Store

rawWrite

Private

Clock

now

Exported


Evaluate each proposal independently, starting from the initial graph and adding both calls in that row together. Assess cycles using every proposed dependency, including one whose call violates the access rule.


Complete the table using exactly one of these labels:

  • interface: only the exported-operation rule is violated.
  • cycle: only the no-cycle rule is violated.
  • both: both rules are violated.
  • neither: neither rule is violated.
ProposalFirst proposed callSecond proposed callViolation label
ATax calls Store.saveClock calls Pricing.quote
BPricing calls Clock.nowTax calls Store.save
CDisplay calls Store.rawWriteTax calls Clock.now
DClock calls Store.rawWriteTax calls Clock.now

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 Modularity Questions: