Quick revision
The short answer
The teams are right for simple CRUD services: four mapping layers protect a domain that has almost no logic to protect. As the owner of the standard, I would change it to match architecture to complexity, with plain layering for CRUD services and hexagonal structure for complex domains or services with many integrations, define clear criteria for choosing, keep a few rules that apply to everyone, such as no entities in APIs and clear module boundaries, and measure delivery speed and defect rates to check that the change helped.
What to remember
In this answer, we handled pushback against a mandated hexagonal architecture. We checked the complaint in real code and found it valid for CRUD services, where four mapping layers protect nothing. We kept what the standard was protecting by offering two shapes, layered for simple services and hexagonal for complex domains or many integrations, chosen by written criteria on business rules, integrations and lifetime. Shared rules such as no entities in APIs and clear boundaries still apply everywhere, and we measure lead time and defect rates to confirm the change helped.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The teams are right for simple CRUD services: four mapping layers protect a domain that has almost no logic to protect. As the owner of the standard, I would change it to match architecture to complexity, with plain layering for CRUD services and hexagonal structure for complex domains or services with many integrations, define clear criteria for choosing, keep a few rules that apply to everyone, such as no entities in APIs and clear module boundaries, and measure delivery speed and defect rates to check that the change helped.
Why this question is asked
Architects who own a standard face this moment sooner or later: a rule that made sense for the services it was designed for is now applied to every service, and the teams paying the cost are pushing back. How we respond matters more than the rule itself. Defending the standard by authority teaches teams to work around it; dropping it entirely loses what it was protecting. Interviewers ask this scenario to see whether we can listen, separate the valid part of a complaint from the rest, and turn a one-size rule into a decision teams can make themselves. In this answer, we will check the complaint against the code, look at what the standard costs and protects, redesign it around complexity, set the criteria, keep the shared rules, and plan how to measure the result.
1Checking the Complaint Against Real Code
The first step is to look before answering. We pick two or three of the services the teams mention and trace one simple change, such as adding a phone number to a customer, through the code. In a strict hexagonal service that change often touches the request DTO, a command object, the domain object, the persistence entity, three mappers and their tests, so one field means eight to ten files.
Then we look at what the domain layer actually does. In a CRUD service it usually does nothing: the domain Customer has the same fields as the entity and the DTO, and the use case calls the repository and returns. There is no rule for the core to protect. So the complaint is valid for these services. Saying so plainly to the teams is important; it buys the trust we need for the parts of the standard we want to keep.
Notice that every mapping copies the same fields. Nothing is translated, validated or protected; the layers are ceremony.
2What the Standard Was Protecting
Before changing the rule, we name what it was meant to do. Hexagonal architecture keeps business rules independent of frameworks and external systems, so that complex rules can be tested quickly and integrations can change without touching the core. That value is real in services such as pricing, payments or claims handling, which have many rules and several integrations, and which live for a long time.
So the problem is not the architecture; it is that the standard applied one answer to every service. A good standard should say when an approach pays for itself, not just which approach to use.
3Redesigning the Standard Around Complexity
The new standard offers two approved shapes. For CRUD and thin integration services, a simple layered structure: controllers with request and response DTOs, services with transactions, and JPA repositories, with entities allowed in the service layer. For services with significant domain logic or many integrations, the hexagonal structure as before, with a framework-free core and ports.
We also allow moving between them. A service that starts as CRUD and grows real rules can introduce a core and ports in the module that needs them. Because the shared rules below keep boundaries clean in both shapes, that move is a refactoring, not a rewrite.
- Count business rules beyond validationpricing, states, eligibility, limits
- More than a handful, changing often?YesHexagonal core for that moduleNoNext question
- Three or more external integrations?YesHexagonal: ports isolate themNoNext question
- Expected to live more than five years?YesLayered now, ports at integrationsNoPlain layered
4 steps in order. Play them, or step through them one at a time.
The criteria are written down with examples, so teams can decide without asking the architect.
4Writing Down the Criteria
Teams should be able to make the choice themselves, so the criteria must be concrete. We use three. The number and volatility of business rules: a service whose logic is validation and storage is simple; one with pricing tiers, state machines or regulatory rules is complex. The number of integrations: each external system is a dependency we may want to replace or fake in tests, so three or more pushes towards ports. The expected lifetime: a service expected to live many years benefits more from isolating frameworks than a short-lived one.
We publish these with two or three real examples from our own services in each category, and the choice for each service is recorded in a short decision record in its repository. If a team is unsure, they ask for a short review; most decisions are obvious once the criteria are written down.
5Rules That Still Apply to Everyone
Relaxing the structure does not mean anything goes. A few rules apply in both shapes because they protect things that matter in every service. JPA entities never appear in API responses, because that couples clients to the schema and triggers lazy loading during serialisation. Modules or feature packages have clear boundaries, and one feature does not reach into another's internals or tables. External systems are always reached through a client class, never called directly from controllers.
These rules stay enforced by the shared ArchUnit rule set in every repository, so the difference between the two shapes is how much structure there is inside a boundary, not whether boundaries exist.
6Measuring Whether the Change Helped
A standard change is an experiment, so we decide how to judge it before rolling it out. We measure lead time for changes, the time from first commit to production, for the CRUD services before and after they adopt the simpler shape, and we count the files touched per typical change. We also watch defect rates and incidents, because the risk of simplifying is that some rules end up in the wrong place.
If after three to six months lead time drops for CRUD services and defect rates stay flat, the change worked. If defects rise in services that chose layered but later grew real logic, we tighten the criteria or add a review point when a service crosses a threshold, such as its fifth integration.
7Follow-up questions
What if some teams use the new freedom to skip structure entirely?
The shared rules prevent the worst outcomes, because entities in APIs, cross-module access and direct external calls still fail the build. Beyond that, the decision record makes the choice visible, and a periodic review of a sample of services catches cases where a service has outgrown its shape.
Should existing hexagonal CRUD services be rewritten?
Not as a project. Teams can simplify a service when they are working in it anyway, for example by removing a domain layer that only copies fields. A mass rewrite would cost more than the ceremony it removes.
How do you communicate the change without looking like you were wrong?
By being direct: the standard was designed for complex services and was applied too broadly, the teams' feedback showed that, and here is the improved version. Owning the mistake openly makes teams more willing to raise problems early next time, which is worth far more than appearing infallible.
8Conclusion
In this answer, we handled pushback against a mandated hexagonal architecture. We checked the complaint in real code and found it valid for CRUD services, where four mapping layers protect nothing. We kept what the standard was protecting by offering two shapes, layered for simple services and hexagonal for complex domains or many integrations, chosen by written criteria on business rules, integrations and lifetime. Shared rules such as no entities in APIs and clear boundaries still apply everywhere, and we measure lead time and defect rates to confirm the change helped.
Open with
First I would check the complaint myself by tracing a simple change through two of the services. If adding one field touches ten files and the domain layer just copies fields, then the teams are right, and I would tell them so directly.
Then, if they want more
The standard was meant to protect business rules and isolate integrations, and that value is real for complex services like pricing or payments, but a CRUD service has almost nothing to protect.
So I would change the standard from one architecture to a choice based on complexity: plain layering for CRUD and thin integration services, and a hexagonal core for services with significant business rules or many external integrations.
I would write the criteria down concretely, things like how many rules beyond validation, how many integrations, and how long the service is expected to live, with real examples from our own services, and have each team record its choice in a decision record.
Some rules would stay for everyone and stay enforced by ArchUnit: no JPA entities in API responses, clear module boundaries with no reaching into another module's tables, and external systems behind client classes.
Then I would measure lead time and files touched per change for the CRUD services, and defect rates, over the next few months, and adjust the criteria if services that chose the simple shape start having problems.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Several teams complain that the company's mandated hexagonal architecture adds four...": https://scrivio-interview-library.netlify.app/java/application-architecture/d498f0b9dd/