|
Razer's Edge: Database Models, Digital Business Rules
Blueprints:
Explanation
and Presentation of the Model and Examples of Data
We've conducted traditional Entity-Relationship modeling techniques in
the domain
of business rules. Our description of the Entities, Attributes and their
relationship
is what follows.
Comparison Rules
Business Rules are actually very simple examined at the most granular
level. Our
assumption is that most, if not all, business scenarios can be described
as a series
of postulates and theorems. An example of a simple business rule is:
account
is 30 days past due
For our purposes, this type of business rule statement is far too vague.
Instead,
the rule should be stated as:
account
pay date plus 30 days is greater than account due date
Aha!
Now that is a statement we can quantify. In fact, it could be translated
into an
algorithm like:
AccountPayDate
+ 30 Days >= AccountDueDate
Now
that we've phrased the business rule as a programmatic statement, we can
begin some data analysis. What does this program structure consist of?
We have
two pieces of data (expression 1, and expression 2) separated by a conditional
expression. In this case, an actual comparison of the data must occur
in order to
evaluate the business rule. Compound Condition Rules Another example of
a business
rule is a compound condition upon which some action is typically executed.
For example,
IF account
is 30 days past due
AND the
cardmember is a platinum cardmember
THEN waive the fee
This one is a bit harder to translate into a programmatic construct, but
lets see if
this works:
IF AccountPayDate
+ 30 Days >= AccountDueDate
AND CardMemberType = 'Platinum'
THEN some action
Lets look at the second rule here: CardMemberType = Platinum. Does this
still adhere to our
definition? Expression1 and Expression 2 are separated by a conditional
expression. Yes. The
expressions in this case are simple expressions that represent a single
piece of data. In fact,
we can define an expression as any piece of data or combination of data
(an expression)
which evaluates to a single data expression. "OR" Conditional rules will
evaluate to true if one
of many possibilities is true before taking some action. An example of
this would be to rephrase
the example from above:
CardMemberStatus
= NewMember
OR CardMemberType = Platinum
THEN Give Frequent Flyer Miles
Again, simple statements combine to make more complex rules. Another frequent
use of business
rule logic is to assign data elements default values. Assigning defaults
is shown in the example below:
CardMemberStatus
= NewMember
OR CardMemberType = Platinum
THEN FrequentFlyerMiles = 10000
Our
assignment of 10000 to the data element 'FrequentFlyerMiles' takes on
the basic for of two
expressions and a condition. Conducting basic data element analysis on
our examples above, we
find the following entities: data (expressions) conditions (relationships)
data rule (business rule)
sets of rules defaults (data defaults) Some of the following statements
can be made about the
relationships of the entity elements above: a basic rule consists of an
evaluation of two pieces of
data over a condition a set of rules is 2 or more data rules joined by
a logical relationship (AND / OR)
a default is some static value which is valid for the data element defaults
can be used by more
than one rule set a rule set can assign more than one default a data rule
can be used in more
than one rule set a business rule consists of one or more granular rule
sets
Lets
Formalize our Entity Definitions a Bit:
Rule Set:
a combination of one or more data rules that always evaluates
to true or false
Data Rules:
binary business rules conditions quantified as a comparison of
operands or expressions over an operator
Data Defaults:
a value which will be applied to one or more data elements
in the system when a rule set evaluates to true.
If we examine
the relationships we've described above, then we see that a M:N relationship
exists between data rules and rule sets. We also see that a M:N relationship
exists between
Rule Sets and Data Defaults.
ER Design
Purists may get a bit upset here since we are modeling data entities for
which there
is little or no information to track and no inherent key values. Keep
in mind, we are digitizing
business rules. Think of it as building a 'virtual data circuit' that
can be tested to see if it is
open or closed. Rule sets will always evaluate to true or false. This
is a basic binary condition
which emulates true or false (0 or 1) and THAT is the fundamental building
block of all computing.
We will follow
basic rules of normalization to derive the following entity-attribute
relationships
rule_sets
{
id_rule_set
(pk)
description
}
data_rule
{
id_data_rule (pk)
data_name
data_value
condition
}
data_default
{
id_data_default (pk)
data_name
data_value
}
rule_set_default
{
id_rule_set (fk)
id_data_default (fk)
default_order
}
data_rule_set
{
id_rule_set (fk)
id_data_rule (fk)
rule_order
}
Simple, right? Let's take a look at some data samples encoded into the
entities from
our examples above:
rule_sets
(id_rule_set, description)
1 check for past due accounts
2 check past due and platinum
3 check for platnium to assign miles
data_rule
(id_data_rule, data_name, data_value, condition)
1 AccountPayDate + 30 AccountDueDate >=
2 CardMemberType "Platinum" =
3 CardMemberStatus "NewMember" =
data_default
(id_data_default, data_name, data_value)
1 FrequentFlyerMiles 10000
2 LateFee 0
3 LateFee 25.00
rule_set_default
(id_rule_set, id_data_default, default_order)
2 2 1
1 3 1
data_rule_set
(id_rule_set, id_data_rule, rule_order)
1 1 1
2 1 1
2 2 2
3 2 1
This simple
set of constructs lets us quantify several variations on many different
types of rules. The key here is that each rule is a simple binary expression:
two
operands and an operator.
We can see
that the number of possible variations on the rule combinations will be
6 based on the rules coded in the data_rule table. By adding more rules
to the
data_rule table, we expand the number of combinations additatively ( Sigma(n)
).
A simple set of 10 rules yields us 55 different possible business rule
combinations!
Of course not all 55 combinations may be logical for your business, but
you get the idea.
Prev
| Next
|