LARMAN CD MODULES

Module 10

Interaction Diagrams

Introduction

In this module, we are focusing on the design of some fine-grained objects in the domain Model, using interaction diagram notation. The main point here is that we are focusing on the notation in the diagrams, not the design. Design is for later modules.

Firstly, though, a little bit of jargon busting. In the UML, the general term given to these diagrams are Interaction Diagrams. They come in two flavours (or specialisations): collaboration and sequence.

Sequence and Collaboration Diagrams

The following diagram depicts a basic collaboration diagram used to illustrate the interaction between two software classes, InstanceA and an InstanceB. We can see that to start off with a message is being sent to an instance of ClassA and then two messages are sent from Class A to an instance of ClassB. Note the numbering of the messages. The first message to A is not numbered, but subsequent messages from A to B are. Also, the path from A to B is a link, and many messages can flow along this one link.

Another notation for interaction diagrams are called sequence diagrams. The main difference between sequence and collaboration is that the sequence diagram is more constrained in terms of how you can layer the objects. This is because the diagram is shown with a notion of time. However, it is easier to see the flow of control (in collaboration, you would need to look at the numbering of the messages).

Larman suggests that you use collaboration diagrams when jotting stuff on the whiteboard, because it is easier to use up the "whitespaces" but if the purpose is to detail and document object design and show the flow of control then use a sequence diagram.

Looking at the Notation for Object Instances

In general, instances are shown by underlining the name of the class, and you can name the instance as well. The underlining is very important. If you don't underline it, it indicates that it is a class object and you are sending a message to the class itself, not an instance of a class.

Another look at Numbering

Now for a little bit more detail on the numbering of sequence and collaboration diagrams. Recall that the first message in collaboration diagrams are not numbered. From then on we are showing the calls and subcalls and sub-sub calls using a numbering scheme 1, 1.1, 1.1.1 etc. This is similar to how we number a contents list, or the way we did the old structured analysis and pseudocode way back in first year.

Looking forward to the design....

Now we have seen some UML notation the next step is to use the notation for the actual design of software objects. This is coming up in the next lot of modules.

Home

Module 1 | Module 5 | Module 6 | Module 7 | Module 8 | Module 9

Module 10 | Module 12 | Module 13 | Module 14