| Home | Design | Process | Tools | Places | About |
|
From Associations To Domain Neutral ComponentDuring a rather indifferent, evening meal at a 1950's style diner in Denver (Yes - it really did look like something out of the old Happy Days television series), Karl Frank (Borland) and I discussed the correlation between the role labels that may be specified on the end of associations in UML and the yellow Role classes found in Peter Coad's Domain Neutral Component. The following short set of notes is the result. I hope you enjoy them.
Examples:1. For employment we add an Employee role class and an Employer role class to capture information specific to the role and provide operations that can iterate over all the associated Employment objects. The Employer class may include an employer's tax code attribute and an operation to pay employees. The Employee role class could have an operation to total income across multiple jobs and/or over a period of time like the tax year.
2. We can do the same for the sale model. If we also add classes for the things being sold and the place where the transaction is happening, we have Party connected to PartyRole connected to Moment-Interval connected to both Place and Thing
Place and Thing RolesUsing similar reasoning, let's add PlaceRole and ThingRole classes to our model. Place roles allow a property to play the role of a store and/or a warehouse and/or a residence for example. Thing roles allow an aircraft to play a military role and/or a civilian role for example. Until now we have been considering situations where we need to track both parties in a relationship or Moment-Interval. Now let's generalize to allow for situations where the second party is not tracked (e.g. a typical customer in grocery store). Now we have a Moment-Interval connected to PartyRole, PlaceRole and ThingRole classes that are connected to Party, Place and Thing respectively. The model is starting to take on a familiar shape.
The Domain Neutral ComponentIf we compare the shape of the object model above with the Domain Neutral Component there are only a few items missing. Add the blue description classes for the Party, Place and Thing classes, a MomentIntervalDetail to represent parts of a sale and we have all the classes in the Domain Neutral Component.
ConclusionWe have seen that the core of the Domain Neutral Component can be derived from a general association by replacing its label and roles with classes. Knowing this it should be less of a surprise when we see the Domain Neutral Component's pattern occurring again and again in our domain models. Of course, the Domain Neutral Component and archetypes also provides us with typical attributes, operations, interactions and interface plug-in points. ReferencesCoad, De Luca, Lefebrve, Java Modeling
in Color with UML, Prentice Hall 1999
This article was first published as CoadLetter #71 while I was an editor/author of that newsletter. It is reproduced here with permission. mission. The original is archived at bdn.borland.com/coadletter. |
More on...
|
||||||||||||||||