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.

Doc Brown
219k35 gold badges405 silver badges619 bronze badges
asked Jul 19, 2016 at 17:03
2

1 Answer 1

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.

answered Jul 19, 2016 at 17:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.