All jobs / Solutions / cloud architect / Architecture Fundamentals
Solutions / cloud architect interview question · 1–3 years
Classic layered architecture versus ports-and-adapters (hexagonal): what does the second one buy you?
The strongest answer
Dependencies point inward: the domain logic knows nothing about the database, web framework or broker, so those can be swapped or faked and the core is tested without infrastructure
Why it works
Right — the point is the direction of dependencies, which makes the core testable and the infrastructure replaceable.
What a good answer covers
- Dependencies point at the domain.
- Domain knows no framework or database.
- Infrastructure implements the ports.
- Test the core without infrastructure.
Answers that fall short
- Close, but not the strongest: A cleaner folder structure that keeps controllers, services and repositories apart
Folders are the visible part; the value is that the domain has no dependency on infrastructure. - Weak: Better runtime performance, because there are fewer layers to pass through
It is about dependency direction, not speed; both styles add the same kind of indirection. - Red flag: Nothing — it is layered architecture with new names for the layers
The names differ because the rule differs: in hexagonal, infrastructure depends on the domain, never the reverse.
Who gets asked this
More Architecture Fundamentals questions
- What architecture documentation do you keep for a system, and how do you stop it going stale?
- When do you build a component in-house rather than buy or adopt one?
- Two options are viable and you cannot know for a year which requirement will dominate. How do you decide?
- What does “that is a trade-off” actually mean, and what is the next sentence?
- A stakeholder says “we need a reporting feature”. How do you turn that into functional requirements you can…
- The brief says “it must be fast and reliable”. What do you do with that sentence?
- What are non-functional requirements, and why do architects spend so much time on them?
- You recognise a textbook architecture pattern that seems to fit a new problem. What do you check before…