NYCPHP Meetup

NYPHP.org

[nycphp-talk] State table implementation ideas

Cliff Hirsch cliff at pinestream.com
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?
 
Cliff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060203/a848cf4f/attachment.html>


More information about the talk mailing list