All challenges
Multiple ChoiceIntermediate 45s

DIP and the composition root

Where should concrete implementations be wired together in an application that follows Dependency Inversion?
Options
  1. 1In a single composition root at the application boundary (main/startup)
  2. 2Inside each domain class's constructor. It resolves its own collaborators.
  3. 3In a static service locator called at runtime. Each class fetches what it needs.
  4. 4In every module that needs an instance. It is built locally at first use.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle