Microsoft Technologies In-Depth
   for IT Managers and Developers


   May/June 2002
       
 
UML Collaboration Diagrams (cont.)

Creating a Collaboration Diagram
When you create a Collaboration diagram, you should place the most important objects involved in the collaboration in the middle of the diagram. This helps set the stage for clearly showing the relationships between collaborating objects.

When designing collaboration diagrams from scratch (versus generating them automatically from sequence diagrams), here are the basic steps to follow:

  • Determine the scope of the diagram. As with sequence diagrams, the scope of a collaboration diagram can be a use case.
  • Place the objects that participate in the collaboration on the diagram. Remember to place the most important objects towards the center of the diagram.
  • If a particular object has a property or maintains a state that is important to the collaboration, set the initial value of the property or state.
  • Create links between the objects.
  • Create messages associated with each link.
  • Add sequence numbers to each message corresponding to the time-ordering of messages in the collaboration.
Objects Changing State
As mentioned in the previous section, you can also adorn objects with properties to indicate their initial state as well as any change in state. However, if an object changes significantly during an interaction, you can add a new instance of the object to the diagram, draw a link between them and add a message with the stereotype <<become>>.

Figure 4 shows an example of this. The Contract object starts out in the "pending" state and eventually becomes "accepted." Notice there is a sequence number associated with this message. Interestingly, I was not able to get Rational Rose to easily show this change in state on a collaboration diagram so I used Visual UML to create the diagram in Figure 4. Visual UML allows you to specifically set the state of an object, but Rational Rose does not.

 
Figure 4: If an object changes significantly during an interaction, you can add a new instance of the class to the diagram and show its changed state.
Although collaboration diagrams are not used as often as sequence diagrams, they are a very useful part of the UML. If you find yourself flipping back and forth between sequence diagrams (dynamic view) and associated class diagrams (static view) to try to get a handle on the associations between business objects, then you may want to try a collaboration diagram instead. It allows you to see both the dynamic aspects of a collaboration as well as the relationships between objects, in a single diagram.


Kevin McNeish is President of Oak Leaf Enterprises, a company that specializes in object-oriented custom software, training and developer tools. He is the creator of The Mere Mortals Framework and has spoken at many software developer conferences and user groups in North America and Europe. He uses Visual FoxPro and the new C# .NET language as his primary development tools. He is co-author of the book "What's New in Visual FoxPro 7" and has also written articles for CoDe, FoxPro Advisor, and FoxTalk magazines. Kevin mentors and trains many software companies to build flexible, component-based applications that scale from the desktop to the Internet. He is a Microsoft Certified Developer and has created many enterprise-wide applications for a wide variety of vertical markets. Reach him at .



From Sequence Diagram to Collaboration Diagram

Why use Collaboration Diagrams?

Why use Collaboration Diagrams? From Sequence Diagram to Collaboration Diagram Creating a Collaboration Diagram


 




 TALK BACK
Have you found collaboration diagrams to be useful in finding flaws in your static models? Do you often use collaboration diagrams or do you find them more trouble than they're worth? Click here to Join
 Sidebars
What is the UML?

Where to Learn More

Get Your CoDe Magazine Trial Issue Now!





 
Copyright Component Developer Magazine and EPS Software Corp., 2002
Sponsored Links

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers

Copyright Information/Privacy Statement