In other words: Where / How do you abstract / encapsulate the logic of determining what is the next step in the wizard, based on what the user selected at the specific step of the wizard?
One way to do this is to simulate the Wizard, Step, and Product classes. Maybe something like this?
public class Wizard
{
public Step forward() {
public Step backward() {
public Step current() {
public Product getProduct() {
}
public class Step
{
public String name() {
public void commit(Product product) {
public void rollback(Product product) {
}
public class Product
{
}
The goal of the wizard is to create a product (car, computer, vacation, etc.).
, - , , . Builder , Wizard, . , , . , Wizard.
Command Pattern /.