Encapsulate what changes

A good design identifies the hotspots most likely to change and encapsulates them behind an interface. When an anticipated change then occurs, the modifications stay local rather than rippling across the system. The stable parts of the design are protected from the parts most likely to shift.

The technique is to take the concept that varies and separate it behind an interface. Sometimes that means pulling the varying concept into its own module so that a change in requirements only touches one place. This is information hiding applied to volatility rather than to implementation detail.

The strategy pattern is a direct application: it isolates an algorithm that varies behind its own interface, so the surrounding context stays stable when the algorithm changes.

Encapsulating what changes complements separation of concerns and modular design, both of which encourage sharp boundaries between distinct areas of the system. When those boundaries align with likely axes of change, the design becomes resilient to evolution.

It is one of the design principles that target adaptability. The goal is not to predict every future change but to keep the parts that shift most often isolated from the parts that rarely do.

See also