Home arrow Practices arrow Page 7 - Design with ArgoUML

Object Modeling Using Archetypes and Color in UML - Practices

This article provides an overview of the practical application of object-oriented analysis and design (OOAD) design concepts and the Unified Modeling Language (UML). It†is taken from chapter two of the book Enterprise Java Development on a Budget, written by Brian Sam-Bodden and Christopher M. Judd (Apress, 2004; ISBN:†1590591259)

TABLE OF CONTENTS:
  1. Design with ArgoUML
  2. The Unified Modeling Language
  3. Model-Driven Architecture and the UML
  4. Design Roadmap
  5. The Editing Pane
  6. Drawing Diagrams in ArgoUML
  7. Object Modeling Using Archetypes and Color in UML
  8. Adding Modeling Elements to the Class Diagram
  9. Assigning Archetypes and Creating Associations
  10. Use Case Modeling
  11. Refining Use Cases with Sequence Diagrams
By: Apress Publishing
Rating: starstarstarstarstar / 35
August 25, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

An insightful and useful technique that hasnít received the level of recognition it deserves is the use of color, as proposed by Peter Coad in his book Java Modeling in Color with UML: Enterprise Components and Process (Prentice Hall PTR). The color in UML technique hinges on the notion of an archetype, which is a concept similar to the concept of a stereotype in UML with the difference being in the rigidity of the definition and its effect on the target class. An archetype is a way to tag a class as something that more or less adheres to a certain set of characteristics. (This is a looser definition than inheritance for example.) Coad started using 3M Post-it Notes, which come in four colors, pink, yellow, blue, and green, to label model elements. Coad assigns a color to each one of the archetypes or class categories. The addition of color gives you a sense of spatial layering that enables designers to quickly capture both structure and behavior and helps you to see dynamism in an otherwise static class diagram. Coad defined the following four main archetypes and associated them with four colors:

  • Moment-Interval (pink): The moment-interval archetype represents an activity that can be tracked in time, something that occurs at a moment in time or over an interval of time. Registering for the conference, submitting payment, and browsing sessions are all examples of Moment-Intervals.

     

  • Role (yellow): The role archetype represents the way something participates in a moment-interval, for example, a person can participate in a conference while playing the role of attendee.

     

  • Description (blue): The catalog-entry description archetype represents a value or set of values that can be used to label a set of things. The easiest way to think of the description archetype is to think of information that classifies an entity but that doesnít define its identity. For example, nationality and immigration status can be considered descriptions for a person while a passport number or green card number will be a part of that personís identity information.

     

  • Party, place, or thing (green): The party, place, or thing archetype, PPT for short, represents the things that can play a role in the different activities of the system.

     

The four basic archetypes are interconnected in a way that repeats over and over in models. This pattern in its simplest form entails a PPT playing a role in a moment-interval, which might affect other PPTs. PPT also might have descriptions associated with them. In this pattern physical entities such as PPT never interact directly but instead are participants (as role players) in an activity.

For example, in the conference attendee example a person (party) is an attendee (role) in the context of a conference (moment-interval). The temporal relationship between the conference and the person is fulfilled by the attended role. This basic pattern is depicted in Figure 2-7.


NOTE

In this book the colors for the Coad Archetypes are represented as shades of gray. Visually the power of the technique hinges on the use of color. To see the images in color visithttp://www.ejdoab. com.

Figure 2-7. Basic relationships between the Coad archetypes

As youíll see later in more detail the main formula is to find an activity (moment-interval), find the participants in that activity (roles), and find who or what is playing that role (party, place, or things). You begin by making a list of possible m-i classes that are central to the system in question. Eventually youíll arrive at a model for which all classes belong to one of the four archetypes. Table 2-4 shows your initial list of m-i candidates. As you can see you started at the highest level and moved toward moments-intervals of finer and finer detail. For example, at the highest level you have the conference as the top m-i class. Conference is an m-i class because itís something that happens over a period of time and can be tracked for legal and business reasons. You can also see that your four main stakeholders are roles played by either a person or an organization of some kind.


NOTE

In their book Java Modeling in Color with UML: Enterprise Components and Process, Coad et al use an archetype called a moment-interval detail, which is also colored pink and labeled with the stereotype mi-detail. Moment-interval details are classes that hold information about a moment-interval class. They are usually associated with a moment-interval via aggregation. In this book we donít use m-i details for the sake of simplicity.

Table 2-4. TCMS Candidate Moment-Interval Classes

Moment-Interval Participants (Roles) Role Player
Conference Sponsors, Administrator, Person/Organization
 Presenter, Attendee  
Conference Registration Attendee, Presenter Person
Conference Track Attendee, Presenter Person
Schedule Attendee, Presenter Person
Session Attendee, Presenter Person
Session Evaluation Attendee Person
Call for Papers Presenter Person


The Domain-Neutral Component

The Domain-Neutral Component The Domain-Neutral Component The Domain-Neutral Component The Domain-Neutral Component The Domain-Neutral Component The Domain-Neutral Component

A more encompassing set of interconnections between the four basic archetypes is the domain-neutral component (DNC), which is a template built upon the four archetypes based on roles being played by the three different entitylike elements (PPTs): party, place, and thing. This results in a template model with three legs or branches: the party branch, the place branch, and the thing branch. The DNC, as originally introduced by Coad, is shown in Figure 2-8.


Figure 2-8. The domain-neutral component

The result is a flexible, semantic-based class diagram template that you can use to build any kind of model. The best part is that itís remarkably simple to use. You donít have to fit your model into the DNC, rather, the DNC will guide you to make your model more complete. The trick about using the DNC is an understanding that archetypes are very flexible definitions, and that elements of the DNC template can be dropped out to simplify the model. Basically you start with a very complete model and progressively collapse or drop archetypes as you go along.

This takes a bit of effort in the beginning because programmers tend to model interactions or temporal relationships between elements as a method in one of the participating elements. The DNC and the four archetypes hinge on the notion of representing these relationships as elements themselves.

You might be asking yourself where weíre going with all this color stuff. The truth is that it takes a bit of time and a couple of models to begin to grasp the power of the technique. But once it sinks in it will help you produce better, more accurate, and complete models. To an extent itís a completeness theorem of sorts, especially when it comes to modeling. Thatís the main goal of the techniqueóto make you a better modeler.



 
 
>>> More Practices Articles          >>> More By Apress Publishing
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PRACTICES ARTICLES

- Calculating Development Project Costs
- More Techniques for Finding Things
- Finding Things
- Finishing the System`s Outlines
- The System in So Many Words
- Basic Data Types and Calculations
- What`s the Address? Pointers
- Design with ArgoUML
- Pragmatic Guidelines: Diagrams That Work
- Five-Step UML: OOAD for Short Attention Span...
- Five-Step UML: OOAD for Short Attention Span...
- Introducing UML: Object-Oriented Analysis an...
- Class and Object Diagrams
- Class Relationships
- Classes

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: