Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Layered architecture is the oldest style in enterprise Java, dating from three-tier J2EE applications. Why has it survived despite criticism, and when should an organisation move beyond it?

Layered architecture survived because it is simple, every developer already knows it, and frameworks such as Spring are organised around the same controller, service and repository split. Its weakness is that its layers are technical, so one feature change touches every layer and models tend to become anemic. It stays a good choice for simple services with little domain logic, and an organisation should move beyond it when domain complexity grows or teams own features rather than layers, often towards feature modules that keep a simple layering inside.

Why this question is asked

Few ideas in enterprise Java have been criticised as often as layered architecture, and few have lasted as long. It goes back to three-tier J2EE applications with JSPs, session beans and entity beans, and it is still what most Spring Boot tutorials and most production services look like. Interviewers ask senior candidates about it to hear a balanced judgement rather than a fashion statement: why something so plain keeps winning, what it genuinely costs, and how to recognise the moment when it stops being enough. In this answer, we will recap the style and where it came from, look at why it survived, examine its real weaknesses, and then discuss when to move beyond it and what to move to.

1A Quick Recap and a Little History

Layered architecture divides an application into horizontal layers, each with a technical responsibility: presentation, business logic and data access. Each layer depends only on the layer below. In the J2EE era of the early 2000s, this matched the physical tiers: a web container for servlets and JSPs, an EJB container for business logic, and a database. Patterns from that time, such as data access objects and session facades, were all about keeping those tiers apart.

When Spring replaced much of J2EE, the tiers collapsed into one process, but the layering stayed in the code. Today the same shape appears as @Controller, @Service and @Repository, which Spring even provides as stereotype annotations.

2Why It Has Survived

The first reason is simplicity. A layered application can be explained in one sentence, and a developer who joins the team on Monday knows where to find the controller for an endpoint by Tuesday. There is no vocabulary of ports, adapters or rings to learn.

The second reason is familiarity. Every Java developer has worked in a layered codebase, every course teaches it and every code generator produces it. Familiarity has real economic value: it shortens onboarding, reduces arguments in code review and lets people move between teams.

The third reason is that it matches how the frameworks are organised. Spring MVC gives us controllers, Spring Data gives us repositories, and @Transactional naturally sits on the service in between. Fighting the grain of the framework costs effort every day; following it is free.

Finally, for a large share of services it is simply the right amount of structure. A service that validates input, applies a few rules and stores the result does not need more.

3Where It Hurts

The weakness is that the layers are technical, not business-oriented. A change to one feature, such as adding a discount code to checkout, usually touches the controller, the request DTO, the service, the entity, the repository and the migration script. Each of those lives in a different package next to classes from every other feature, so the change is spread across the codebase and reviewers see one feature scattered across six folders.

The second weakness is the anemic domain model. Because the service layer is where logic goes, entities tend to become bags of getters and setters, and business rules accumulate in services. When two services both need the rule that an order cannot be cancelled after shipping, each writes its own if statement, and they drift apart.

The third weakness is that layers make poor ownership boundaries. If a team owns checkout, a layered codebase gives them no package they can call theirs; they share every layer with every other team, and coupling between features grows unnoticed because nothing in the structure separates them.

Layered versus feature modules
QuestionLayeredFeature modules, layered inside
Where is checkout code?spread across controller, service, repository packagesin com.acme.checkout
Files touched to add a fieldabout 6, in 5 packagesabout 6, in 1 package
Can features hide internals?rarely, everything is publicyes, package-private and module rules
Fits team ownership?poorly, all teams share all layerswell, one team per module
Learning costlowestlow
Feature modules keep the familiar layers but cut the codebase along business lines first.

4When to Stay and When to Move Beyond It

Layered architecture stays a good choice for services with little domain logic: CRUD services, thin integration services, internal admin tools, reporting endpoints. For those, alternatives such as hexagonal architecture add interfaces and mapping code that protect nothing. A good test is to describe the service's rules; if the description is mostly fields and validations, layering is enough.

Two signals tell us it is time to move on. The first is domain complexity: the service has real business rules, such as pricing, eligibility or state machines, that change often and need careful testing without the database. The second is organisational: several teams work in one codebase and own features, not layers, so they need boundaries that match their ownership. When we see services of several thousand classes with one shared service package, or merge conflicts between teams in the same layer, both signals are usually present.

5The Common Destination: Feature Modules With Simple Layers Inside

Moving beyond layering rarely means throwing it away. The most common and successful step is to cut the codebase into feature modules first, such as orders, billing and inventory, and keep a simple controller, service and repository layering inside each module. Each module exposes a small public API, hides the rest, and can be checked with ArchUnit or Spring Modulith.

Where a module's domain is genuinely complex, that module can adopt a richer internal style, such as a hexagonal core with rich domain objects, without forcing the same ceremony on the simple modules next to it. So the organisation gets business-aligned boundaries everywhere and extra structure only where it pays. The familiar layers survive, just one level down.

6Follow-up questions

Is the anemic domain model always bad?

No. For a service whose rules are simple and live in one place, data classes plus a service are perfectly readable. It becomes a problem when the same rules are needed in several places and get duplicated, or when the rules are complex enough that putting them next to the data they protect would make them easier to test and reason about.

How would you convince a team to move from layers to feature modules?

With their own data. We show how many packages a typical feature change touches, where merge conflicts come from, and how coupled the features already are, and then move one feature as a pilot. Teams usually notice quickly that a feature package is easier to work in, and the change spreads from there.

Does microservices adoption make layering irrelevant?

No. Most microservices are small and layered inside, which is often right. What changes is that the service boundary now does the job feature modules do in a monolith. If the services are cut by technical layer instead, for example a separate data service, the same weakness returns in distributed form.

7Conclusion

In this answer, we saw why layered architecture has lasted since three-tier J2EE. It is simple, familiar to everyone and matches how Spring is organised, and for simple services it is enough. Its weaknesses are that technical layers scatter each feature across the codebase, models tend to become anemic, and layers do not match team ownership. When domain complexity grows or teams own features, the usual step is feature modules with simple layers inside, adding a richer style only in the modules that need it.

What to say in the interviewAbout 80 seconds aloud

Open with

I think layered architecture has survived because it is genuinely good at a few things. It is simple to explain, every Java developer already knows it, and it matches how Spring is built, with controllers, services with transactions, and Spring Data repositories.

Then, if they want more

Familiarity is worth real money in onboarding and in moving people between teams, and for a large share of services, CRUD and thin integration services, it is exactly the right amount of structure. Its weaknesses are real, though.

The layers are technical, so a single feature change touches the controller, DTO, service, entity and repository, spread across packages shared with every other feature. Logic piles up in services while entities become data bags, so rules get duplicated. And the layers do not match team ownership, because every team shares every layer.

I would move beyond it when the domain has rules complex enough to deserve their own tests and model, or when several teams own features in one codebase.

Even then I would not throw layering away: the usual step is feature modules, each with a small public API and simple layers inside, checked with ArchUnit or Spring Modulith, and a richer hexagonal core only in the modules whose domain needs it.

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 "Layered architecture is the oldest style in enterprise Java, dating from three-tier J2EE...": https://scrivio-interview-library.netlify.app/java/application-architecture/8694e47732/