vendredi 21 octobre 2016

Is usage of state in controller a smell?

Suppose I have some gui application, which is created via mvc architecture. As I understood, usage of state machine design pattern in controller is usual case. Or maybe it is sign of bad design?

Simple example (without usage of State design pattern):

enum State
{
    Idle,
    MoveControl,
    MoveCanvas,
    // ......
};

void Controller::onMouseMove(/**/)
{
    switch (state)
    {
    // ...
    }
}

Aucun commentaire:

Enregistrer un commentaire