The DEAT Business Rule Pattern Language

Russell R. Hurlbut, Ph.D.

Previous | Table of Contents | Next

Rule Pattern 3: Domain

Problem Describing Valid Values for an Attribute

The state on an entity can be determined at any given point in time by the values of its attributes. In certain states, attributes may be restricted in the values considered valid for that state. For example, a person sitting in a car on his driveway should expect the speedometer to read 0 miles per hour. However, there are exceptional conditions that may alter this observation. If a car is in an auto mechanic shop and the car is supported such that the wheels are free, this stationary car may register a value on the speedometer that doesn't reflect the current situation. Conversely, the person may be sitting is his car while being ferried on a boat. In this case, the vehicle is moving relative to the earth's surface but not showing on the speedometer. Finally, the car may be performing stunts off a ramp that casts it into the air is such a way that the speed and speedometer do not match. Although normal behavior may be well defined, other states represent valid values in exceptional states. If is often desirable that the exceptional states be considered valid, but also maintain constraints for normal behavior. Further difficulty arises when the value becomes the determining factor in establishing the exceptional state.

Solution

Describing valid states for an attribute can be addressed by establishing valid value domains for attributes of an entity. If the domain is discrete, an enumeration of domain values may suffice. This is mostly applicable for state and type attributes. A numeric domain may be discrete or continuous. The most generic application of the Domain business rule pattern is for continuous values. Discrete numeric values are a subset of the continuous range though application of the Interval business rule pattern by defining origin and interval parameters. Subsets of enumeration domains may be specified through application of the Type Membership business rule pattern.

Global default domains can be established for basic attribute types such as date-time, currency, temperature, and age. Minimum and maximum values may be defined with various ranges by applying the Range Set business rule pattern. The global default range may be applied as the default for all basic data types. The range can establish invalid and exceptional value boundaries. Other ranges may be established that override at the entity type level, a specific attribute level, or even at a specific instance level. Additional ranges may be based on certain states for an entity that. In this context, the state of the object is checked against the range boundaries specified for a state attribute. This state attribute may be derived from a number of other attributes, including the one under consideration.

The Domain business rule pattern utilized a layered set of parameters that cover three dimensions as shown in table below. Layering is primarily concerned with the scope of the parameter. Although this specification pattern does not dictate a specific implementation strategy, inclusion of the context dimension may be facilitated by an approach that readily supports determination of states based on combination of attributes. In this manner, exceptional behavior handing is possible without ruling the value immediately as invalid. In other words, the response for a given scope may be to trigger exception handling, which in turn determines the state and checks to see if these values can be considered acceptable. Additional processing or alternative behavioral logic may then be applied to pass the value as acceptable.

Domain Rule Pattern - Parameter Dimensions
Dimension

Examples

Scope

data type, attribute type, entity type, specific attribute of an entity, specific instance, specific instance attribute

Context Instance state
Response Invalid, exception handling

Example Phone Number Type

. A very basic application of the Domain pattern is to simply enumerate the possible values for a type. In this example a phone number may be classified as any of the values in its domain without restriction. Thus, this represents a global rule that applies any attribute that is declared as a phone number type.

Phone Number Type Parameters
Type
Phone Number Type
Domain residence, business, cell, fax, pager, modem, interactive voice response (IVR)

Example Cash Deposit

A bank deposit may provide for a global default of the largest amount of currency that can be expressed. However, for the purposes of a deposit, a more restrictive range is established. Specifically, a negative amount may not be valid and precision is limited to the smallest currency unit. Denomination units do not apply to computing interest, which is subject to rounding by applying the Interval pattern.

This example shows a deposit that triggers an exception handing situation. This exception may be due to federal regulations or bank policy. Nonetheless, conditional behavior is invoked. It is even possible to dynamically override the cash deposit valid range once conditional branching in invoked if the Self-Modification business rule pattern is realized in the implementation environment. This would allow a cash deposit of over the valid limit of $1,000,000 by applying an override to this particular deposit instance. Alternatively, the customer making the deposit may be included in a set that is not subject to certain processing, such as the result of another workflow process that placed certain pertinent documents on file that satisfied processing requirements. In this case, the allowable limit is relaxed somewhat. Note that only the specification of an exception is made. This specification remains implementation independent.

Cash Deposit Parameters and Case Values

Parameters:
Global default for currency valid range $ (999,999,999,999.9999) to $ 999,999,999,999.9999
Deposit valid range $ 0.00 to $ 999,999,999,999.99
Cash Deposit valid range $ 0.00 to $ 1,000,000.00
Cash Deposit exception range $ 0.00 to $ 10,000.00
Cash Deposit w/documents on file $ 0.00 to $ 50,000.00

Case:
Input Deposit of $54,376.63 of which $ 12,316.82 is by cash and the remainder by check
Output Exception


UML Representation and Related Patterns

The Domain business rule pattern is a single model element represented though identification of its scope, context, and response attributes as shown in the Pattern Dimension Table. No other structural connections exist in the basic pattern. Collaborations with other model elements may only exist through composition of the Domain pattern with other business rule patterns. The Interval pattern may be used in conjunction with discrete numeric values. The Type Membership pattern enables naming of subsets of enumeration domains specified by the Domain pattern. The Self-Modification pattern collaborates with the Domain pattern thresholds to dynamically modify behavior.

Previous | Table of Contents | Next

Copyright 1998 Expertech.Ltd. All Rights Reserved.
Legal