After analyzing the primary domain information in the last post we started putting together a domain model with an added focus on normalization and aggregation:
Aggregation in this sense is applying the Aggregate pattern per Domain Driven Design by Eric Evans. This pattern states that aggregates are clusters composed of objects that are typically worked with as single units (loading, rules evaluation, etc.)
There have been additional refinements and additions to the domain model since last time:
- Standard regions (states and provinces) in Canada and USA must be pre-defined, however other countries (e.g. Mexico) should still be selectable without a region. In this scenario the region will be filled in manually as part of the address block.
- Multiple phone types (e.g. home, mobile, etc.) and address types (e.g. home, business, etc.) will be available but we must be able to easily add new types without changing the application. This means we will normalize the data and avoid compile-time enumerations. The same applies for item types and option types.
- Orders must have at least one line item.
- Orders will have a process state. The states are well defined and will not change once the application is deployed so they don’t have the same requirement are phone types.
- There will be no support for password recovery – only password resets.
At this time we are not implementing any change tracking support as there is no requirement for it (although it will come up later).
Below is the model diagram so far (cheating by using Visual Studio’s class diagram in place of UML). So far we’ve exposed four aggregates:
- Regions
- Contacts
- Orders
- Orderable Items
We will continue driving out the model for each of the aggregates. There will be additional entities to deal with things such as default settings but we will avoid those until needed.
We are not addressing implied validation unless required. For example we do not explicitly state that a date field must be a valid date.
Contacts & Regions
A customer is simply a generic contact that contains information typical of an address book entry. It may contain multiple phone numbers and address of a pre-defined type.
| Field |
Optionality |
Validation |
Comments |
| Alias |
1 |
Unique |
Typically last name of customer. |
| CompanyName |
0..1 |
Required if no LastName |
|
| LastName |
0..1 |
Required if no CompanyName |
|
| FirstName |
0..1 |
|
|
| Email |
0..1 |
RFC 3696 |
Use catch-most errors algorithm. Full and complete E-mail validation is complex when dealing with |
| PhoneNumber collection |
0..n |
Up to one of each PhoneType. |
|
| Address collection |
0..n |
Up to one of each AddressType. |
Defaults with types Home, Business, Shipping. |
Employee will extend a contact since an employee could also be a customer. This allows reuse of the logic for managing employee contact information as customers. The employee will have a unique username and hash of his or her password.
PhoneNumber is a 10-digit NANPA (North American Numbering Plan Area) format or ‘+’ notation for international numbers. Reformatting of entered phone number is allowed. Up to one of each PhoneType where types are types Business, Home, Mobile, and Fax.
Address is mostly optional. The Street field will be multi-line capable to allow adding mail stops, c/o, and arbitrary international shipping information as required.
| Field |
Optionality |
Validation |
Comments |
| Street |
0..1 |
|
Multi-line capable. |
| City |
0..1 |
|
|
| PostalCode |
0..1 |
Must conform to ZIP (or ZIP+4) for USA or Canadian postal code formats. |
|
| Region |
0..1 |
Required if Country is USA or Canada. |
|
| Country |
1 |
If a USA or Canada region is selected this field must be as appropriate. |
Defaults to country of use. |
Country, by default, will contain all the countries in the world adhering to the ISO 3166-1 alpha-2 country code standard. Abbreviation is two-letter country code (e.g. USA is US, Canada is CA, Mexico is MX, etc.).
Region, by default, will contain all the regions (provinces and states) in USA and Canada adhering to the ISO 3166-2 region code standard. Abbreviation is 2nd-part of region code consisting of two letters (e.g. CA is California in USA, AB is Alberta in Canada, etc.).
Orders & Orderable Items
Each Order is composed of orderable items (Items, ItemProperties, Options) and a variety of Contacts or specific Contact Addresses.
| Field |
Optionality |
Validation |
Comments |
| Comments |
0..1 |
|
Internal use (not used for generated order forms) |
| ContractPrice |
1 |
>= 0 |
Monetary. |
| OrderComments |
0..1 |
|
Used for generated order form. |
| OrderDate |
1 |
>= Year 2000 |
|
| OrderState |
1 |
|
Enumeration. |
| RequiredDate |
0..1 |
>= Year 2000 |
|
| ShipDate |
0..1 |
>= Year 2000 |
|
| Employee |
1 |
|
|
| Customer |
1 |
|
|
| Shipper |
0..1 |
|
|
| Referral |
0..1 |
|
|
| BillingAddress |
0..1 |
|
Address specification for the billee. |
| ShippingAddress |
0..1 |
|
Address specificaion for the shipee. |
| OrderItems collection |
1..n |
|
|
| Options collection |
0..n |
|
|
The lower portion of the order model diagram is complicated on how an Item is associated with types and properties. The following order snippet is used to explain the relationships between orders, items, and properties when the Imperial Marcesa Item is ordered.
An Order has OrderItem line items. Each OrderItem is composed of:
- A single Item (e.g. Imperial Marcesa and Adjustable Screen)
- A collection of OrderItemProperty’s. An OrderItemProperty holds the ItemProperty value for each OrderItem (e.g. Width of 15’ for Imperial Marcesa)
Each Item is of a defined ItemType (Imperial Marcesa Item is a Window Awning ItemType and the Adjustable Screen Item is an Accessory ItemType). The ItemType is important as it defines which ItemProperty’s are available (Window Awning ItemType has Quantity, Width, Projection, Fabric, Control, Motor Type and Hood Cover ItemProperty’s while the Adjustable Screen ItemType only has the Quantity ItemProperty).
ItemProperty also defines an ItemType’s Optionality (required/optional/not available). Patio Awnings ItemType require the quantity, width, projection, fabric, and control side columns filled (Optionality = 1) while motor type and hood cover columns are optional (Optionality = 0..1).
To help further this concept the following relational diagram can be used since domain model data (but not the behavior) tends to closely map to a entity relationship diagram (ERD). It illustrates the relationships for an Order of an Imperial Marcesa Item that has a Width PropertyType of 15’.

In the next post we’re going to evaluate user experience (UX) requirements to help define some of the infrastructure.
Recent Comments