mardi 22 août 2017

Design pattern to execute several steps (functions) in Java

I have several classes like MyClass below (different implementations). What would be the best pattern to apply here for all these classes (Visitor/Decorator) - an example would be great?

public Class MyClass implements MyInterface{

public void execute(){

functionA();
functionB();
functionC();
functionD();
functionE();

}

@override
private void functionA(){
//some specific implementation
}

@override
private void functionB(){
//some specific implementation
}

@override
private void functionC(){
//some specific implementation
}

@override
private void functionD(){
//some specific implementation
}

@override
private void functionE(){
//some specific implementation
}


}

Aucun commentaire:

Enregistrer un commentaire