All jobs / Backend developer / Architecture
Backend developer interview question · 5+ years
A team proposes ports and adapters for a service that reads a queue, writes to one database, and will never have a second client.
Do you agree?
The strongest answer
Not for its own sake — it pays when adapters change or the rules are complex; here I would keep the domain logic out of the framework and add ports when something genuinely needs a second adapter
Why it works
Exactly — name what it buys and what it costs, then take the cheap half now and the rest when there is a reason.
What a good answer covers
- Structure is a means, not a goal.
- Keep the domain free of transport.
- Add ports when a second adapter appears.
- Name the cost, not only the benefit.
Answers that fall short
- Close, but not the strongest: It is worth it anyway: the indirection costs very little and it makes the service easier to test
Testability is real, and “costs very little” is the claim to check: each port is an interface with one implementation somebody has to read. - Weak: No — layered code is simpler, and a service this small should just call the database from the handler
Calling the database from the handler is what makes the rules untestable later; separation is not the same as ceremony. - Red flag: Yes, always: every service should use the same architecture so anyone can move between them
Uniformity is a genuine benefit, but a rule with no trade-off attached ships a folder structure instead of a design.
Who gets asked this
More Architecture questions
- The interviewer asks: “Two years of events, consumers you don't own. How do you evolve the schema?” Strongest…
- The interviewer asks: “Auth, TLS, and WAF — in every service or at the gateway?” Strongest answer?
- An interviewer says: “Design a URL shortener.” What do you do first?
- What does a load balancer do, and what does it not do?
- What is the difference between scaling up and scaling out?
- Why do interviewers keep asking whether a service is stateless?
- When does adding a cache help, and when does it not?
- In a design, why do you say which columns are indexed?