Domains can be looked at as an extension to traditional data types for use at the design level. As such, they have two purposes:
- They define the “set of all valid values that an attribute (ie. data element) can take.” In other words, they provide data validation at the data element level and transformation into the internal data format. For example, a date value of “02/30/2004” would always generate an error, while a date value of “04/28/2005” would be accepted and converted into the internal data value for a date.
- They provide the rules that define how a data element will be entered on input and displayed on output. For example, dates can be entered and displayed using the American format of “12/15/2005” or the European format of “15-12-2005”.
Since all object data in AOA is “encapsulated,” all data must pass through domain validations to ever be stored in a database. Thus, Domains are an important part of the data integrity functionality within AOA. They also automate the formatting of data on data interfaces.
Since the same kind of data can be formatted differently in different situations (ex., dates are often displayed differently and revenue values are displayed with different revenue symbols and, sometimes, even written as text), Domains can have various groupings of format definitions called Contexts. Though there is always a default Context, the default Context can be overridden on any interface definition. The first diagram to the right shows the definition of a Revenue domain, with four contexts for handling four different display formats. The formatting of those Contexts is handled within a Domain Operation, which in this case is given the same name as the Domain.
The second two diagrams show the definition of the most common type of Domain, which is a table. The first shows the definition of the table domain, StudentStatus. There is very little to define here except that it is a Table Domain with a single Context.
The third diagram shows the definition of its Context values. Note that there are both an internal value and an external value defined for each Context entry. The internal value is that which is stored in the object and database. The external value is that which is presented on all user interfaces. If an interface is either an MS window or a web page, the interface control can be defined as a combo box, which allows the user to set the value from a drop-down list.