vendredi 11 septembre 2015

Sequencing calls to methods: From 1 controller or recursive?

What are the pros and cons of each of the following patterns, demonstrating very common situations, for example initializing process at the beginning of the program:

Recursive calls:

void foo1() {
    //do some work
    foo2();
}

void foo2() {
    //do some work
    foo3();
}

void foo3() {
    //do some work
    //end
}

or from 1 main controller:

void main() {
    foo1();
    foo2();
    foo3();
}

Aucun commentaire:

Enregistrer un commentaire