Modelling Collaborations

Design Process

•     What?         Requirements & Analysis

•     How?          Design

•     Design

– Develop logical solution through interaction diagrams and design class diagrams

– Interaction Diagrams

»   Illustrate how objects will communicate to fulfil the requirements

– Design Class Diagrams

»   Contain definitions of classes that are to be implemented in software

Design

•     Open up the black box

– Describe how the software will work

– Specify elements of the software

•     Use input/output of the black box

– to define the inside of the box

•     Think in terms of software and not real world

– Production of software

– Not analysis of problem domain

 

 

Interaction Diagrams

•      Illustrate how objects interact via messages to fulfil tasks

•      Depend on

– Domain/Conceptual model

»   Designer derives classes from the concepts

»   Objects of those classes participate in the interaction diagrams

– Operation contracts for system operations

»   Designer identifies responsibilities and post-conditions that the interaction diagram must fulfil

– Real or essential use cases

»   Designer may deduce some additional information to be fulfilled for the interaction diagrams

Interaction Diagrams (Cont.)

•      Used for dynamic object modelling

– Illustrate the interactions (messages sent and received) between instances of the classes in the class model

– Starting point for the interactions is the fulfilment of the postconditions of the operation contracts

•      Two types of interaction diagrams:

– Sequence Diagram

»   Illustrates interactions showing instances, messages, and a lifeline for instances

– Communication Diagram

»   Illustrates object interactions in a graph or network format containing instances, links, and messages

Which diagram to use?

•      Sequence and communication diagrams carry the same information – in different form

•      UML tools usually emphasize sequence diagrams

Strength and Weaknesses

•      Sequence diagrams

– Strengths:

»   Shows time ordering of messages

»   Large set of detailed notation options

– Weaknesses

»   Consumes horizontal space

•      Communication diagrams

– Strengths

»   Space economical

– Weaknesses

»   More difficult to see sequence of messages

»   Fewer Notation options

 

Guidelines for Creating
Interaction Diagrams

•      Create a separate diagram for each system operation under development

– With the system operation (message) as a starting point

•      If the diagram gets complex, split it.

•      Design a system of interacting objects to fulfil the operation / contract / responsibilities / obligations from use cases

•      Spend time doing dynamic object modelling with interaction diagrams, not just static object modelling with class diagrams!

Guidelines for Creating
Interaction Diagrams (Cont.)

•      Create initial versions for all operations

•      Create Design Class Diagrams

•      Use Design Patterns

– GRASP

– GoF

•      Revisit

– Design Class Diagrams

– Interaction Diagrams

Sample Development Process

•      ...

•      Analysis

– Conceptual Modelling

– Defining System Behaviour

•      Design

– Defining the system’s internal structure

»   Interaction diagrams

»   Class Diagrams

– Defining system interface

•      ...

Class Diagrams

•      UML includes class diagrams to illustrate

– Classes

– Interfaces

– Associations

•      Class diagrams are used for static object modelling

•      Class diagrams have already been used in a conceptual perspective in domain modelling

•      Now, we will use class diagrams in a design  or software perspective

Design Class Diagrams

•      Design class diagrams contain

– Software classes and interfaces that participate in the software solution

– Annotated with design details

•      Software classes – not real world concepts

 

Contents of Design Class Diagrams

•      Classes

•      Attributes

– with type information

•      Associations

– with navigability information

•      Operations

– Methods with full signatures

Constructing Design Class Diagrams

•      Analyse interaction diagrams and identify classes participating in software solution

– Draw them in a class diagram

•      Duplicate attributes from the associated concepts

•      Analyse interaction diagrams and add method names

•      Add type information to attributes and methods

•      Add associations to support access to attributes

•      Add navigability information to indicate attribute visibility

Identifying Software Classes

•      Analyse the domain model

– Find which concepts should be represented in the software

•      Try to answer

– Should the system keep any information about concept X

– Should the system know about concept Y

•      If the answer is ‘yes’

–Copy the concept from the domain model to the design class diagram