if (a || (b and (c or d)) and (not e or (f and g and h))) then ???
September 25, 2007 7:24 PM Subscribe
Comp Sci: What's the best Design Pattern or structure for dealing with a complex relationship between many booleans?
posted by grumblebee to computers & internet (34 answers total) 1 user marked this as a favorite
I'm working on an app that has a zillion configuration options. I need to deal with situations in which the user choses Option A and (Option B or Option C) but not (Option D and (Option E or F)). That sort of thing.
Using tons of if/then/else's is clearly wrong. It's totally confusing. The State Pattern seems like the right direction, but unless I misunderstand it, it's too simple. It assumes that an app is in State A, State B or State C. What about apps that are in States A and C? In other words, there are 50 options and any combination of them can be on/off.
What's the best way to manage this?
I'm an Actionscript Programmer, but I'm pretty comfortable translating concepts from C-family languages.