UML Models in Software Engineering: Use Cases, Classes, Collaborations, Sequences, Slides of Software Engineering

An overview of uml models, focusing on use case diagrams, class diagrams, collaborations, and sequence diagrams in the context of software engineering. Use case diagrams illustrate the interaction between users and the system, while class diagrams depict the static structure of the system. Collaborations and sequence diagrams show how objects interact to perform tasks and the passage of time, respectively. Useful for university students studying software engineering, particularly in the context of uml modeling and interaction diagrams.

Typology: Slides

2011/2012

Uploaded on 07/16/2012

sanaka
sanaka 🇮🇳

4.6

(21)

71 documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Outline
Use case diagrams
Collaborations
Interaction on collaboration diagrams
Sequence diagrams
Messages from an object to itself
Suppressing detailed behaviour
Creation and deletion of objects
Timing
1 COMP201 - Software Engineering
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download UML Models in Software Engineering: Use Cases, Classes, Collaborations, Sequences and more Slides Software Engineering in PDF only on Docsity!

Outline

 Use case diagrams

 Collaborations

 Interaction on collaboration diagrams

 Sequence diagrams

 Messages from an object to itself

 Suppressing detailed behaviour

 Creation and deletion of objects

 Timing

Use Case Diagrams

 Use case diagrams show the interaction of users of

the system with the functionality of the system.

 A use case is a functional component of the system

that accomplishes a specific task, and is represented by an ellipse.

 An actor , depicted as a stickman figure, is a user

(human or non-human) of the system performing a specific role.

 Use case diagrams are used early in the

development process to refine the functional specifications, identify user interface requirements and to define the scope of the project.

Actor

UseCase

UML Use Cases

 Remember that it’s also necessary to describe each use

case. To describe a use case, we could use natural

language, structured natural language, sequence

diagrams, state diagrams etc.

 If we use an <> relation, we should also describe

which of the use cases will be chosen.

 The <> and <> relations are an

advanced feature and should be used with care;

remember they add to the complexity of the diagram.

Class Diagrams

  • A Class diagram shows the static structure of the system.
  • It defines model elements such as classes , interfaces , and user-defined data types , their internal structure, and their relationships to each other.
  • Relationships, or associations , are shown as lines connecting elements, and are annotated to describe the relationships and their cardinality (1..1, 1.., 0.., etc.).
  • Inheritance (generalize/specialize), aggregation (comprises), and composition (has) relationships are also captured in this diagram.

Class Diagram Example

+Person() +setName() : void +setSsn() : void +setDob() : void +setSpouse() : void +setChildren() : Set +getName() : String +getSsn() : String +getDob() : Date +getSpouse() : Person +getChildren() : Set +getAge() : int

#name : String #ssn : String #dob : Date #spouse : Person #children : Set

Person (^) +setMajor() : void +setClassStanding() : void +computeGpa() : void

-major : String -classStanding : String -gpa : float

Student

+Professor() +setRank() : void +setTenureDate() : void +setDepartment() : void +getRank() : String +getTenureDate() : Date +getDepartment() : String

-rank : String -tenureDate : Date -department : String

Professor

+CourseOffering() +setSectionNo() : void +setCourse() : void +setInstructor() : void +setSchedule() : void +setLocation() : void +setMaxEnrollment() : void +get...() +calcAvailable() : int

-sectionNo : int -course : Course -instructor : Professor -schedule : String -location : String -maxEnrollment : int -enrollment : int -prerequisites : Set

CourseOffering

0..* -teaches -is taught by

1..

-is taken by 0..*

-takes 0..* «extends»

«extends»

Important UML Models

 We have now seen the two most important UML models:

 The use case model , which describes the tasks which the system must help to perform  The class model , which describes the classes which are to be implemented and the relationships between them

 UML’s interaction diagrams allow us to record, in detail,

how objects interact to perform a task

A Simple Collaboration, Showing no Interaction

 A collaboration, without any interaction shown, is rather like an instance of part of the class model. It shows objects, links and actors

Interaction on Collaboration Diagrams

 Each labelled arrow represents a message sent from the object at the tail of the arrow to the object at the point of the arrow.

 Furthermore, the target object must understand the message

 That is, the class of the object at the point of the arrow must provide the appropriate operation

Interaction Shown on a Sequence Diagram

 The vertical dimension of a sequence diagram

represents time

 The horizontal dimension represents the different

objects or roles that participate in the interactive

sequence.

 An object’s lifeline is shown as a narrow vertical bar.

  1. List all the pairs of classes that can communicate directly with each other.
  2. For each class, list all the methods that need to be included, based on this sequence diagram

resource manager

Res. Mgr. Win: UI :Worker :Skill :SkillLevel

find worker

find skill

assign skill to worker

find worker by name

find skill by name

[worker does not currently have skill] assign skill to worker

Homework

Messages from an Object to Itself

 An object may, and frequently does, send a message to

itself (i.e. An object calls another method on itself; Java uses keyword “this”).

 On a collaboration diagram you show a link from the

object to itself, and messages pass along that link in the usual way

 On a sequence diagram, you show a message arrow

from the object’s lifeline back to itself.

Suppressing Detailed Behaviour

 It is often sensible to describe interaction at a higher level,

rather than showing every message between every pair of

objects.

 To do this we define a (full) sub-collaboration of a

collaboration

 Collaboration is a collection of objects and links

between them

 Sub-collaboration is a subset of the objects, together

with the links connecting those objects.

Using a Package to Simplify a Collaboration