Jordan Marr wrote:
> I never posted my solution to Whose Fish, and since my old thread
> probably has a stigma attached to it, I'll post it here.
Come on, a mad catfight is not a "stigma" :-)
> The object model contains two objects: House, and Street. Each of
> these objects inherit from EntityBase which is my Domain Supertype
> that adds validation rule handling and an IsValid property.
> Basically, my app creates and maintains 5 lists of houses based on
> house order. The program iterates through all permutations of house
> configurations (including house order), and only the valid houses are
> stored in the appropriate list (1st through 5th).
> Then I iterate through all permutations of valid houses to build a
> possible street and test its validity. This runs until a valid street
> is found.
> Rules are factored into two types of rules: house level, and street
> level. House level rules deal with one house configuration, and
> street rules deal the releationship of two houses to each other.
> It takes different amounts of time to run, depending on what order I
> put the enum / attributes in. Anywhere from 1 to 19 seconds tops.
> The first pass just filters houses using house rules, and contains
> only simple relative position rules (ones that can be determined soley
> from the "order" property). The resulting number of houses determines
> how many possible permutations of streets will need to be tested, so
> filtering is crucial at this level. A few more houses can result in
> thousands or millions of new streets to test. One breakthrough I had
> here was to extrapolate from the existing rules as many new rules as
> possible for the first round. This is how I got my max run time from
> literally days to 19 seconds tops! But like I said, i've seen it run
> in as little as a few seconds, depending on the inital order of
> attributes. All extrapolated rules are followed by a lowercase letter
> ("Rule4a", "Rule4b", etc).
> // - - - - - - the app - - - - -
I was thinking of a way to make this problem more real-world instead
of textbook-puzzle-ish. One possible application would be crime
solving, or perhaps terrorist tracking. Data about people, places,
things, and relationships would all be in a data wearhouse and an
inference engine of some type could chew on it to find potential
trouble spots or leads. (Instead of "who has the fish", the
questions may resemble, "who may have a bomb".)
One change from your kind of solution is that specific instances would
not be hard-wired into the app code. Classification systems would also
not be hard-wired if we really don't want to make programmers
glorified data entry clerks. People, places, things, and categories
will be entered by domain experts, not programmers for the most part.
It always seemed to me that if you remove domain classification from
app code, the result will not be very OOP. There would be little or no
need for inheritence or polymorphism. If you disagree, I would like to
understand why, with perhaps some examples.