What’s the OOP way of dealing with a flow control heavy application?

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.


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.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *