liveBook · Manning

Implementation detail

As explained in Simple Object-Oriented Design: Create clean, maintainable applications

An implementation detail is an internal choice about how a software component performs its behavior that clients do not need to know.

An implementation detail is an internal choice a component uses to do its work. Clients should depend on the smallest stable interface they need, not on internal classes, field names, framework behavior, or other details likely to change. This is information hiding: separate what is likely to change from what is not, so components can evolve independently. section 4.2 section 7.5

Coupling to details turns a local refactoring into a wider maintenance problem. A changed internal class can break dependent modules; knowledge of those dependencies can also discourage a team from improving its own code. Hiding every detail is impossible, so the practical design task is to choose deliberately what to expose, conceal volatile behavior behind a stable abstraction, and reveal no more information than clients require. section 4.2 section 7.3.2

Treat implementation details as a dependency-management boundary:

  • Expose a clear API or interface rather than internal classes and packages. section 7.3.2 section 7.5
  • Ask whether a client would be affected by an internal refactoring and whether the exposed code changes frequently. section 4.2
  • Isolate infrastructure-specific code instead of scattering it through the codebase. section 6.1.2
  • Ignore leaked internals when possible, and raise the leak with the owning team rather than building a dependency on it. section 7.3.1

Indirect framework leakage

An interface can hide Hibernate while a Hibernate-managed entity still leaks behavior: closing a transaction may persist it automatically, and a getter may trigger database queries. When that behavior is undesirable in domain code, add a layer whose contract prevents Hibernate from managing the entities used there. The framework detail remains understood by developers, but is no longer allowed to control unrelated code. section 6.3.2

Internal names are not an API

Depending on an internal class is fragile; depending on its field names is even more so. IDEs coupled to field names in JUnit 4 could stop working after a rename. Document public packages and APIs, and enforce boundaries with tools such as ArchUnit or JPMS so accidental internal dependencies are caught early. section 7.3.2

Figure 7.3 Modules shouldn’t use internal classes of other modules.

Use the module-boundary diagram to distinguish a supported module interface from internal classes that neighboring modules should not consume. section 7.3.2

Implementation details should be hidden from code that does not need them, not hidden from developers making design decisions. Infrastructure and imperfect module boundaries still require informed judgment: extra isolation adds effort, and a visible leak may have a valid reason. Favor the level of concealment that limits future change impact without adding unnecessary elegance. section 6.3.2 section 7.3.1

How Simple Object-Oriented Design: Create clean, maintainable applications covers it

How deep it goes
Explains exposure decisions, infrastructure leakage, client responsibility, and Java-based boundary enforcement without prescribing a universal abstraction strategy.
Examples
Uses Hibernate-managed entities, JUnit 4 field-name coupling, IDE breakage, ArchUnit, and JPMS as concrete cases.
What it assumes
Assumes familiarity with classes, modules, interfaces, and infrastructure choices rather than teaching object-oriented fundamentals from zero.
What you can do after
Apply it by designing stable APIs, isolating infrastructure code, and preventing dependencies on internal module classes.
How it connects
Connects implementation details with information hiding, interfaces, dependency management, modularization, infrastructure, and coupling.

Also explained in

Compare how 3 books explain implementation detail →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Simple Object-Oriented Design: Create clean, maintainable applications. The section links point to the parts of the book it draws on.