All challenges
Multiple ChoiceBeginner 45s

Dependency inversion at package level

A domain module needs to send emails but should not depend on any specific mail SDK. Which structure best applies Dependency Inversion?
Options
  1. 1Domain defines a NotificationPort interface; an infrastructure package implements it with the SDK
  2. 2The domain module imports the mail SDK directly and calls its send method from entities
  3. 3Put the mail SDK inside the domain package so entities can call it as a convenience
  4. 4Have the mail SDK inject itself into the domain module through a global singleton instance

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