H
hazz
before I start filling up the first page of perhaps many pages of code with
if/then or switch:case buckets, I wanted to step back and see if there is a
better way...
I will have a table with up to 300 rules in it. Maybe more... In each Score
table there is a column which will refer to a domain specific table and
another table column that contains the property of that domain specific
object. IceCream is a domain and scoops is a property I want to compare
against. There are two other columns which have an operator (=,>,<) and a
value to compare against. And a score assigned to that rule. If
object.value > 100,000 scoops of ice cream, assign a score of 100.
Basically a rule will compare a value for an object which has already been
hydrated from the database and goes through the rule filter, which I have
yet to build. If object.value > target.value then assign score. Keep a
cumulative score as this object, with its various properties and property
values, as it drops through the logic filter.
I am trying to prevent an unwieldy control flow maze. Does anyone have
ideas? I have heard about control structures like the HybridDictionary but I
am having a difficult time imagineering that. I know what to do with an ice
cream cone, especially chocolate chip, but I don't know what to do with a
HybridDictionary object.
Maintanability of this engine would be important as well as the possibilty
of caching all the rules so that no database calls are required after the
service or executable is running. Thank you. -hazz
if/then or switch:case buckets, I wanted to step back and see if there is a
better way...
I will have a table with up to 300 rules in it. Maybe more... In each Score
table there is a column which will refer to a domain specific table and
another table column that contains the property of that domain specific
object. IceCream is a domain and scoops is a property I want to compare
against. There are two other columns which have an operator (=,>,<) and a
value to compare against. And a score assigned to that rule. If
object.value > 100,000 scoops of ice cream, assign a score of 100.
Basically a rule will compare a value for an object which has already been
hydrated from the database and goes through the rule filter, which I have
yet to build. If object.value > target.value then assign score. Keep a
cumulative score as this object, with its various properties and property
values, as it drops through the logic filter.
I am trying to prevent an unwieldy control flow maze. Does anyone have
ideas? I have heard about control structures like the HybridDictionary but I
am having a difficult time imagineering that. I know what to do with an ice
cream cone, especially chocolate chip, but I don't know what to do with a
HybridDictionary object.
Maintanability of this engine would be important as well as the possibilty
of caching all the rules so that no database calls are required after the
service or executable is running. Thank you. -hazz