SOLID & Design Patterns Interview Question #105

How do Clean, Onion, and Hexagonal Architecture differ?

Architectural Patterns, Application Boundaries & Distributed Design Patterns Senior Advanced

Quick Interview Answer

Clean, Onion, and Hexagonal Architecture use different terminology and diagrams, but all emphasize protecting core business logic from infrastructure details and controlling dependency direction.

Detailed Explanation

Clean, Onion, and Hexagonal Architecture use different terminology and diagrams, but all emphasize protecting core business logic from infrastructure details and controlling dependency direction.

Clean Architecture commonly discusses use cases and dependency rules. Onion emphasizes concentric layers around the domain. Hexagonal emphasizes ports and adapters at system boundaries. Teams should focus on the underlying separation principles rather than treating the names as rigid templates.

Code Example

Common idea:

External Technology
       |
   Adapters
       |
 Application
       |
    Domain