[nycphp-talk] State table implementation ideas

Cliff Hirsch cliff at
Fri Feb 3 13:03:07 EST 2006

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the talk mailing list