Can happen to have a class that implements an interface like:
interface ICommand
{
public function execute();
}
class deleteCommand implements ICommand
{
public function execute() {
if($this->validateConditions()) {
$this->performExecute()
} else {
// do something else ..
}
}
public function performExecute() {
// the real code we want to execute
}
}
My question is:
I maybe heard some term like performExecute() method is a "template", but I'm not sure. I guess this should be some kind of abstraction pattern.
Can someone give a proper name to this pattern? Or maybe point me to some article/documentation?
If you were calling performExecute
on a "helper" object then it would be the Delegate Pattern. Without that layer of abstraction, I think it's less of an official Design Pattern and more just normal subroutine usage.