Skip to main content
InterviewHubPRO
Section Overview
Q46

Question 46 of 50

Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

92%
SOLID & OOP Principles (50 Qs)•Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

DIP in Clean Architecture / Hexagonal Architecture (Ports and Adapters).

senior LevelSystem Design

In Simple Words:

  • The Core Invariant: The domain layer (Entities and Use Cases) sits at the center and knows nothing about databases, web frameworks, or third-party APIs.
  • Ports (Interfaces): Defined inside the Domain layer (e.g. UserRepository, EmailSender).
  • Adapters (Implementations): Live on the outside perimeter (e.g. PostgresUserRepository, SendGridEmailSender).
  • Source code dependencies point strictly inward. You can replace PostgreSQL with MongoDB without changing a single line of domain business logic!