Search code examples
design-patterns

Which patterns should I use when I building wizard GUI (next, back, cancel)


I'm drowning in switch / if / else hell. I'm trying to build wizard that hold a lot of pages and states.

I have 5 main categories and in each category I have a wizard. Now I'm doing it with zillion switch's and if's there must be better way for that. I am looking for design patterns.


Solution

  • its obvious - State

    every your page can be treated as separated state

    http://sourcemaking.com/design_patterns/state

    so you need state machine - some kind of:

    page1 -> page2 -> page3 or page4 .... and so on