File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes State pattern - Wizard implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "State pattern - Wizard implementation" Watch "State pattern - Wizard implementation" New topic
Author

State pattern - Wizard implementation

Omkar Shetkar
Greenhorn

Joined: Jun 22, 2006
Posts: 28

Hi,

I am refactoring a legacy code to implement wizard. I thought of refactoring using state pattern.
A wizard may consist of related/unrelated steps. Each step can be considered as a state. A controller/context to control the flow of the wizard.

My problem is w.r.to input of flow/sequence of wizard steps. This flow can be handled

1. in controller with lot of if...else statements. OR
2. each state can tell the controller which should be the next state.

Problem with the first solution it will complicate and maintenance will become difficult.
If I go with the second solution, the next state decision will get tightly coupled with the state. If in future I want to reuse the state, I can't resue it since it is tightly coupled with the next state decision behavior.

[moderator corrected the title]

Are there any other ways of inputting/controlling the STEP flow?

Thanks & Regards,
Omkar V S


http://www.omkarvs.blogspot.com
 
IntelliJ Java IDE
 
subject: State pattern - Wizard implementation
 
Threads others viewed
struts vs spring framework
Template Method Pattern
mvc question
Using an Applet inside Struts - any nice idea?
Distributing tasks
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture