template-method-safe-inheritance-reuse

Status: OUT

Template Method provides safe inheritance-based reuse by constraining the inheritance mechanism: the parent controls the algorithm skeleton and limits subclass variation to hook operations and abstract operations, avoiding the full exposure of parent internals.

Justifications

Template Method is safe reuse only insofar as inheritance doesn't break encapsulation; when it does, even controlled hook/abstract-op variation exposes parent implementation details

Depends on (SL): gof-template-method-hooks-vs-abstract-ops, gof-template-method-hollywood-principle, factory-method-called-within-template-methods

Unless: inheritance-breaks-encapsulation

JSON