3

I'm refactoring a huge WPF application whose complexity stems from the way it deals with flow control. It has a lot of "tiny business rules" that make it really difficult to make a modification without breaking something. These rules are things like

If the window mode is foo but this is the first time they've pressed this button and the user has a certain role, show this, else validate another thing and show that, else show another thing.

I've thought about creating a lot of different classes for validation and keeping the global state but I'm not sure if there's a design pattern or something focused on dealing with this kind of situation.

3

One approach that might fit is a finite state machine. There are tools that help you build and visualize them but you can also model it with standard OOP practices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.