C
cstratelos
Hello,
I am currently working on a finite state machine framework and the use
of the command and state design patterns (as well as some other ones
obviously) has come up naturally.
So, the state design pattern seems to be the most logical solution to a
state dependent system. The problem is that most of the examples,
tutorials, discussions and books (the GOF book and the Head First
Design Patterns) I have read on this pattern only use a very small
number of states. What happens when your system can be modeled with
hundreds of states for example?
One such occasion is when there is a number of variables (or degrees of
freedom, or whatever you want to call them) the system has to get from
the user. If I create a state for each variable then it becomes obvious
that the number of states grows very rapidly.
For example if the system has variables A, B and C then you could have
the following states:
Var_A_Is_Filled
Var_B_Is_Filled
Var_C_Is_Filled
Vars_AB_Are_Filled
Vars_AC_Are_Filled
Vars_BC_Are_Filled
Vars_ABC_Are_Filled
and all the transitions between them.
Any thoughts?
PS: How do you go about extending the pattern in order to allow for the
system to be in multiple states at the same time?
I am currently working on a finite state machine framework and the use
of the command and state design patterns (as well as some other ones
obviously) has come up naturally.
So, the state design pattern seems to be the most logical solution to a
state dependent system. The problem is that most of the examples,
tutorials, discussions and books (the GOF book and the Head First
Design Patterns) I have read on this pattern only use a very small
number of states. What happens when your system can be modeled with
hundreds of states for example?
One such occasion is when there is a number of variables (or degrees of
freedom, or whatever you want to call them) the system has to get from
the user. If I create a state for each variable then it becomes obvious
that the number of states grows very rapidly.
For example if the system has variables A, B and C then you could have
the following states:
Var_A_Is_Filled
Var_B_Is_Filled
Var_C_Is_Filled
Vars_AB_Are_Filled
Vars_AC_Are_Filled
Vars_BC_Are_Filled
Vars_ABC_Are_Filled
and all the transitions between them.
Any thoughts?
PS: How do you go about extending the pattern in order to allow for the
system to be in multiple states at the same time?