1) What have we at the beginning?
At the beginning we have some class called "ClassA". Which defines one method "doA".
Implementation takes place in non public method: "doStep1", "doStep2", "doStep3"
public function doA()
protected function doStep1()
echo 'ClassA doing step 1' . PHP_EOL;
protected function doStep2()
echo 'ClassA doing step 2' . PHP_EOL;
protected function doStep3()
echo 'ClassA doing step 3' . PHP_EOL;
2) What are new requirements ?
It's turned out that we have a new requirements. In some cases we need to change implementation of individual steps.
3) What do we do?
We are creating subclass and change implementation of particular steps.