Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

Your organization has over-applied design principles: many single-implementation interfaces, deep abstraction layers and factories everywhere, which slow delivery. How do you correct course without swinging to unstructured code?

Every abstraction costs indirection, extra files and reading effort, and it only pays off where real variation or a real boundary exists. We correct course by setting a clear rule for when an abstraction is added, removing unused layers when we touch code under test protection, protecting the boundaries that matter with architecture tests, and judging the result by delivery metrics such as lead time and change failure rate.

Why this question is asked

Over-abstraction usually starts with good intentions. Someone reads that code should depend on interfaces, a template generates a factory per service, and a few years later a two-line change needs edits in seven files. Delivery slows, new joiners get lost, and the natural reaction is to swing the other way and stop designing at all. Interviewers ask this at senior levels because correcting it needs both technical judgement and the ability to change habits across many teams. In this answer, we will look at what over-abstraction costs, set a simple rule for when an abstraction is worth it, remove layers safely, protect the boundaries we keep, and measure whether the change helped.

1What Over-Abstraction Looks Like in Practice

Here is a typical shape. Each piece is reasonable alone, but together they turn one behaviour into a scavenger hunt.

Java
public interface OrderService { Order place(Cart cart); } // one implementation, ever
public class OrderServiceImpl implements OrderService {
private final OrderProcessor processor;
public Order place(Cart cart) { return processor.process(cart); }
}
public interface OrderProcessorFactory { OrderProcessor create(); } // always returns the same class
public abstract class AbstractOrderProcessor implements OrderProcessor {
public final Order process(Cart c) { validate(c); return doProcess(c); }
protected abstract Order doProcess(Cart c);
}
public class DefaultOrderProcessor extends AbstractOrderProcessor { /* the real logic */ }
// To find what place() does: 6 types, 5 files, 4 jumps in the IDE

None of these types adds a decision. There is one order service, one processor, one factory result and one subclass. The reader pays for each hop, and so does the next person who has to change it: adding a parameter to place() means editing every layer. Notice also that the original reason for many of these interfaces has gone away. Spring can proxy plain classes for transactions, and Mockito can mock classes, so an interface is no longer needed just to make testing or AOP work.

2What an Abstraction Costs, and When It Pays

We should talk about abstractions the way we talk about dependencies: each one has a price. The price is indirection when reading, more files and more names to remember, longer change paths, and a design that becomes harder to change because callers depend on its shape. The return is that variation can be added without touching callers, or that two teams can work on either side of a boundary independently.

So an abstraction pays when variation or a boundary is real, not imagined. A payment port with three providers behind it pays every day. An interface for a class that has had one implementation for five years has cost five years of extra reading and returned nothing. The honest observation is that we are bad at predicting future variation, and adding the interface later, when the second implementation arrives, is usually a ten-minute IDE refactoring.

3A Clear Rule for Adding an Abstraction

Teams need guidance they can apply in review without a debate. A rule that works well is to add an abstraction only when one of three things is true: there is a second implementation now, not someday; the code sits on a team or module boundary that others depend on; or there is a test that cannot be written otherwise, for example because the real collaborator calls an external system.

Step throughShould we add an interface or layer here?
  1. Is there a second implementation today?
    YesAdd the abstractionNoCheck the next question
  2. Is this a team or module boundary?
    YesAdd it and own it as an APINoCheck the next question
  3. Is there a test we cannot write otherwise?
    YesAdd the smallest seam that enables itNoUse the concrete class
  4. Revisit when a new need appearsExtracting an interface later is cheap

4 steps in order. Play them, or step through them one at a time.

Three reasons justify an abstraction; anything else waits until one of them is true.

The rule is deliberately not 'never add interfaces'. External systems, published module APIs and plug-in points still get them. That is the guard against the opposite failure, where everything becomes concrete classes calling each other across the whole codebase.

4Removing Layers Safely When We Touch the Code

We do not stop delivery for a big clean-up. Instead we adopt a boy-scout rule: when a change already touches a layered area, we first make sure tests cover the behaviour through its public entry point, and then we collapse the layers that fail the rule. Most of this is mechanical: inline the factory, inline the single-implementation interface into its class, and merge a template base class into its only subclass.

Java
// After: same behaviour, covered by the same tests through place()
@Service
public class OrderService {
private final PaymentGateway payments; // kept: three providers implement it
private final OrderRepository orders;
@Transactional
public Order place(Cart cart) {
validate(cart);
Order order = Order.from(cart);
payments.charge(order.total());
return orders.save(order);
}
}
// 2 files instead of 5; the boundary that matters, PaymentGateway, stays

The tests are what make this safe. They should test behaviour through place(), not the internal layers, otherwise collapsing layers breaks tests that were only checking structure. Where such tests are missing, writing them is the first step of the change.

5Protecting the Boundaries That Matter

Removing needless layers is only half the work. The other half is to make the important boundaries stronger, so that simplifying does not slide into a ball of mud. Architecture tests do this cheaply. Instead of an interface everywhere, we state the few rules we really care about and let the build enforce them.

Java
@ArchTest
static final ArchRule modulesRespectBoundaries =
layeredArchitecture().consideringOnlyDependenciesInLayers()
.layer("Web").definedBy("..web..")
.layer("Domain").definedBy("..domain..")
.layer("Persistence").definedBy("..persistence..")
.whereLayer("Web").mayNotBeAccessedByAnyLayer()
.whereLayer("Persistence").mayOnlyBeAccessedByLayers("Domain");

For modular monoliths, Spring Modulith offers a similar verification of module boundaries. Either way, a dozen rules in a test protect more than a thousand interfaces, because they fail when the boundary is crossed rather than relying on everyone to remember why an interface exists.

6Measuring Whether the Change Helped

To avoid replacing one dogma with another, we judge the course correction by outcomes. Lead time for changes, from commit to production, should fall as change paths get shorter. Change failure rate, the share of deployments that cause an incident or a rollback, should not rise, which tells us we did not lose safety. We can add simpler signals too: files touched per change, and how long new joiners take to ship their first feature.

In practice, a pilot works well. Pick two teams, apply the guidance for a quarter, and compare their numbers with their own previous quarter. If lead time drops from, say, five days to three and failures stay flat, the data does the persuading. Reviews then discuss these numbers and concrete costs, never whether something is SOLID enough.

7Follow-up questions

How do you convince the engineers who introduced the layers?

We avoid making it about who was wrong. The layers often came from a reasonable rule or a template, and the people who wrote them usually care about quality. We show the cost on a real change, such as a ticket that touched seven files for one field, ask them to help write the new guidance, and let a pilot's numbers settle the question.

What about interfaces needed for mocking in unit tests?

Mockito can mock concrete classes, so a test alone rarely needs an interface. The real question is whether the collaborator is slow or external. If it calls a database or an HTTP service, a port is justified. If it is plain in-process logic, it is usually better to use the real object in the test.

Is there a risk that teams now under-design?

Yes, which is why the guidance keeps abstractions at external systems and module boundaries and adds architecture tests. We also watch the change failure rate and change coupling. If failures rise or unrelated packages start changing together, we tighten the rules again.

8Conclusion

In this answer, we saw that every abstraction has a cost in indirection, files and reading effort, and pays off only where real variation or a boundary exists. We set a three-part rule for adding one, removed unused layers when touching code with behaviour-level tests as protection, used architecture tests to keep the boundaries that matter, and judged the result with lead time and change failure rate rather than principle names.

What to say in the interviewAbout 90 seconds aloud

Open with

I'd start by treating abstraction as something with a cost, like a dependency. Each interface or layer adds indirection, files and reading effort, and it pays off only where variation or a boundary is real.

Then, if they want more

A single-implementation interface with a factory and an abstract base class gives us nothing but hops.

Then I'd set a simple rule teams can apply in review: add an abstraction when there's a second implementation today, when the code is a team or module boundary, or when there's a test that genuinely can't be written otherwise, usually because it calls an external system.

Extracting an interface later is a cheap refactoring, so we don't need to predict the future. I wouldn't run a big clean-up project. When a change touches a layered area, we first make sure there are behaviour-level tests through the public entry point, and then we inline the factory, the single-use interface and the template base class.

To avoid swinging to unstructured code, I'd strengthen the boundaries we keep with ArchUnit or Spring Modulith tests, so the build fails if the web layer reaches the repositories. Finally, I'd pilot it with a couple of teams and look at lead time and change failure rate.

If changes ship faster and failures don't rise, the data makes the case, and reviews talk about concrete costs instead of principle names.

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 documentation below. 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 "Your organization has over-applied design principles: many single-implementation...": https://scrivio-interview-library.netlify.app/java/oop-principles/c4384ceab9/