vendredi 21 août 2015

Processes in Sequence design pattern

Scenario:
I have some methods that process some steps of a kind of workflow process. Each method do something in a object and pass on the same object to another method. Something like that:

void MethodA(SomeType obj)
{
    // Some Process

    MethodB(obj);
}

void MethodB(SomeType obj)
{
    // Some Process

    MethodC(obj);
}

void MethodC(SomeType obj)
{
    // keep going...
}

Complication:
The system is growing and I notice that I need to call this 'queue of steps' in some different places of the system. But to other places a few steps change, some can't be executed and new ones need to be executed. In general the queue changes but the steps don't.

Question
Is there a Design Pattern that allow me to build steps separated and join them only when I need to run?

Aucun commentaire:

Enregistrer un commentaire