views:

44

answers:

1

In my web application I have wizards with many next previous buttons and choices ( kind of flow chart with events and options ). Wizard do not run in one go, but may wait for external event, user come later or next day to carry on with that wizard. Currently I am manually writing code ( hard coded ) for each states of a wizard ( or a flow chart ) and running through it.

Now, as number of wizards grows, I would like to make it more object oriented, to make it more easy to write new states and wizards.

How should I design my classes for different states and wizards ?

I am using python programming language. So, If there is reference implementation in python, It will be cool to look at.

+1  A: 

Looks like you want a Finite State Machine (AKA "FSM") -- if so, see here.

Alex Martelli