NYCPHP Meetup

NYPHP.org

[nycphp-talk] State table implementation ideas

tedd tedd at sperling.com
Sat Feb 4 18:11:39 EST 2006


>On Feb 3, 2006, at 1:03 PM, Cliff Hirsch wrote:
>
>>I need to generate an "options list" that is based on several 
>>status fields. Sort of like, "if you can rub your belly, scratch 
>>your head and stand on one foot, you can proceed past the 
>>breathalyzer test, join the circus or run for governor of 
>>Massachusetts.
>>
>>What started as a simple if statement has grown into multiple 
>>switch statements with some if statements thrown in just to make 
>>things completely confusing. While this "compresses"  a state 
>>diagram, its getting unwieldy.
>>
>>So now I'm thinking of throwing the whole thing into a lookup table.
>>
>>Field A   Field B ... Field N        Options
>>
>>While this will result in a large array and many duplicate rows 
>>(since many of the possibilities are actually the same), it should 
>>be really easy to maintain and a great visual aid for those unlucky 
>>souls that inherit my code.
>>
>>Any other  ideas? Or is a lookup table the best solution?
>>
>>
>
>Fun problem Cliff...
>
>I wrote this program to explore the possibilities...


Cliff & Glenn:

What, pray tell, are you guys doing?

Glen, I ran your code and received an "option_b" -- what does that 
mean? Is it fatal?

Thanks.

tedd
-- 
--------------------------------------------------------------------------------
http://sperling.com/



More information about the talk mailing list