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开发者_StackOverflow中文版 ( 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.
Looks like you want a Finite State Machine (AKA "FSM") -- if so, see here.
精彩评论