NYCPHP Meetup

NYPHP.org

[nycphp-talk] State table implementation ideas

Jonathan Hendler hendler at simmons.edu
Fri Feb 3 23:36:03 EST 2006


I was thinking of governer.

The problem with a basic lookup table isn't really that there are 
duplicates, it's that there are a finite number of fields. So if you 
ever want to expand your options list, a lot of things have to change 
(code/schema, etc)

I don't understand the problem you are trying to solve very well. Could 
you explain further?

One way is something called a Directed Graph. The directed graph data 
structure can be used to create complex dependencies and priorities. 
Then your run something called a Topological sort on the data. So now 
you say, "I'd rather not". But there is a PEAR package that implements 
this. RDF/OWL Sementic web tools can also be used for this.
Funny thing is, a directed graph and/or "network" can also be 
represented as a matrix, and you can run algorithms against that that 
are less generalized.

More simply though, Entity Relationship diagrams can also be useful for 
"normalizing" your data and fitting them to relational databases. If you 
can abstract these concepts you have a good chance.



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?
>  
> Cliff
>
>------------------------------------------------------------------------
>
>_______________________________________________
>New York PHP Community Talk Mailing List
>http://lists.nyphp.org/mailman/listinfo/talk
>New York PHP Conference and Expo 2006
>http://www.nyphpcon.com
>Show Your Participation in New York PHP
>http://www.nyphp.org/show_participation.php
>  
>




More information about the talk mailing list