liveBook · Manning

Indirection

As explained in Build High Value Software Systems

An additional layer of reference or mediation through which software accesses an object, operation, or dependency.

Indirection adds a layer between software and the object, operation, or rule it needs. It becomes wasteful when the problem does not require that extra structure: reviewers must reason about design instead of behavior, and changes carry added cognitive and maintenance costs. section 3.3.2 section 2.4.6

Before adding a layer, ask:

  • What real variability does this structure address? section 2.4.6
  • What cost does it impose now, and is the problem theoretical or observed? section 2.4.6

An order service

A generated order service adds dependency injection, caching, validation, and an assumed tax rate beyond the request. Those layers make the code look complete, but reviewers must assess invented structure rather than the requested behavior. section 3.3.2

Listing 2.6 Overprocessing waste
// Simple, sufficient solution
boolean isValidUsername(String username) {
    return username.length() >= 10;
}
 
// Overprocessed version
class ValidationContext {
    private final Map<String, Integer> rules;
 
    ValidationContext(Map<String, Integer> rules) {
        this.rules = rules;
    }
 
    boolean validate(String key, String value) {
        return value.length() >= rules.getOrDefault(key, 0);
    }
}
 

Compare a direct username-length check with a configurable validation context: the latter adds setup and paths without evidence that rules vary. section 2.4.6

How Build High Value Software Systems covers it

How deep it goes
Contrasts simple and overprocessed code, explains costs, and offers diagnostic questions without developing implementation internals.
Examples
Shows an order service with unrequested features and configurable username validation where a direct rule suffices.
What you can do after
Evaluate whether added structure addresses observed variability or imposes costs without solving a current problem.
How it connects
Connects indirection to overprocessing, overengineering, premature optimization, configurability, and abstraction.

Also explained in

Compare how 2 books explain indirection →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build High Value Software Systems. The section links point to the parts of the book it draws on.