際際滷

際際滷Share a Scribd company logo
CHAPTER 5 SYSTEM MODELING
Software Engineering
LECTURE 17: SEQUENCE DIAGRAM AND CLASS DIAGRAM
1
Sequence Diagram
CHAPTER 5 SYSTEM MODELING 2
Sequence Diagrams

A sequence diagram shows the sequence of interactions
that take place during a particular use case.

You read them from top to bottom to see the order of
the actions that take place.

Issue an e-book from a library

Lookup a catalog

Request for issue

Download the ebook
Sequence Diagram Example
:Library User
Ecat:
Catalog
Lookup
Issue
Display
:Library Item Lib1:
NetServer
Issue licence
Accept licence
Compress
Deliver
Sequence Diagram Elements: Targets
Targets: Objects as well as classes can be
targets on a sequence diagram, which means
that messages can be sent to them. A target is
displayed as a rectangle with some text in it.
Below the target, its lifeline extends for as long
as the target exists. The lifeline is displayed as a
vertical dashed line.
Targets: Objects
Objects

Basic notation for an object is:

Both name and type are optional but atleast one should be present
Targets: Objects
As with any UML-element, you can add a stereotype to a target.
Targets: Objects
An object should be named only if at least one of the following
applies

You want to refer to it during the interaction as a message
parameter or return value

You don't mention its type

There are other anonymous objects of the same type and giving
them names is the only way to differentiate them
Targets: MultiObjects
When you want to show how a client interacts with the
elements of a collection, you can use a multiobject. Its
basic notation is
Again, a name and/or type can be specified. Note however
that the 'Type' part designates the type of the elements
and not the type of the collection itself.
Targets: Class

A basic notation for class is:

Only class messages (e.g. shared or static methods in
some programming languages) can be sent to a class.
Note that the text of a class is not underlined, which is
how you can distinguish it from an object.
Sequence Diagram Elements:
Messages

When a target sends a message to another target, it is
shown as an arrow between their lifelines. The arrow
originates at the sender and ends at the receiver. Near
the arrow, the name and parameters of the message are
shown.

Messages can be of two types

Synchronous Messages

Asynchronous Messages
Messages: Synchronous Messages

A synchronous message is used when the sender waits until the
receiver has finished processing the message, only then does the
caller continue (i.e. a blocking call). Most method calls in object-
oriented programming languages are synchronous. A closed and
filled arrowhead signifies that the message is sent
synchronously.
Messages: Synchronous Messages

The white rectangles on a lifeline are called activations and
indicate that an object is responding to a message. It starts
when the message is received and ends when the object is
done handling the message.

If you want to show that the receiver has finished processing
the message and returns control to the sender, draw a dashed
arrow from receiver to sender. Optionally, a value that the
receiver returns to the sender can be placed near the return
arrow.
Messages: Asynchronous Messages
With an asynchronous message, the sender does not wait for the
receiver to finish processing the message, it continues immediately.
Messages sent to a receiver in another process or calls that start a
new thread are examples of asynchronous messages. An open
arrowhead is used to indicate that a message is sent asynchrously.
Targets Creation and Destruction
Targets that exist at the start of an interaction are placed at the top of
the diagram. Any targets that are created during the interaction are
placed further down the diagram, at their time of creation.
Conditional Interaction
A message can include a guard, which signifies that the message is only sent if a certain
condition is met. The guard is simply that condition between brackets.
Sending out several messages on the same condition:
Alternative Interaction
If you want to show several alternative interactions, use an 'alt' combined fragment. The
combined fragment contains an operand for each alternative. Each alternative has a guard and
contains the interaction that occurs when the condition for that guard is met.
Repeated Interaction
When a message is prefixed with an asterisk (the '*'-symbol), it means that the message is sent
repeatedly. A guard indicates the condition that determines whether or not the message should
be sent (again). As long as the condition holds, the message is repeated.
Repeated Interaction
A more common use of repetition is sending the same message to
different elements in a collection. In such a scenario, the receiver of
the repeated message is a multiobject and the guard indicates the
condition that controls the repetition.
Example
To give an exam, an instructor first notifies the students of the exam date
and the material to be covered. She then prepares the exam paper (with
sample solutions), gets it copied to produce enough copies for the class,
and hands it out to students on the designated time and location. The
students write their answers to exam questions and hand in their papers to
the instructor. The instructor then gives the exam papers to the TAs, along
with sample solutions to each question, and gets them to mark it. She then
records all marks and returns the papers to the students.
Draw a sequence diagram that represents this process. Make sure to show
when is each actor participating in the process. Also, show the operation
that is carried out during each interaction, and what its arguments are
Example Solution
Structural models
CHAPTER 5 SYSTEM MODELING 22
30/10/2014
Structural Models

Structural models of software display the organization of a
system in terms of components that make up the system
and their relationship

Structural models may be

Static Modelsstructure of the system

Dynamic Models-- structure of the system when executing

Today's focus will be on class diagrams for modelling the
static structure of the program
Class Diagrams

Class diagrams are used when developing an object-oriented system model to
show the classes in a system and the associations between these classes.

An association is a link between classes that indicates that there is some
relationship between these classes.

When you are developing models during the early stages of the software
engineering process, objects represent something in the real world, such as a
patient, a prescription, doctor, etc.

A implementation is developed you usually need to define additional
implementation objects

Today we will focus on modeling real world objects as part of the requirement
or early stage software design.
UML Class Diagrams

Class diagrams in UML can be expressed at different level of
detail.

At the first stage of developing a model, look at the world and
identify the essential objects and represent them as class.

The simplest way is to write the name of the class in a box
Patient
UML Class Diagrams (cont)

You can also note the existence of an association by drawing a
line between the classes

You can annotate the relationship to show how many objects
are involved in the association
Patient PatientRecord
Patient PatientRecord
1 1
Class Associations

You can name the relationships and other multiplicities of
objects in any association are also possible as shown here:
Patient Doctor
* 1
ReferredBy
Patient
Medical
Condition
1..* 1..*
Diagnosed With
Adding Details to class diagrams

When showing the association between the classes it is convenient to
represent these classes in the simplest possible way.

To define them in more detail you add information about their attributes
and operations
Patient

Name

Registration Number

Blood Group

medicines

getPatientName()

addMedicine()

RemoveMedicine()

...
Relation Ship Types
Example
Http Server
ShareIT

uploadFile()
TCP/IP Stack
Aggregation and Composition
Library
Books
1 .. *
HumanBody
Muscles
1 .. *
Deciding Which Classes To Use
Deciding Which Classes To Use
Noun Identification: A library System
Noun Identification: A library System
Candidate Classes
Relationship between classes
Methods
A Possible Class Diagram
Key points
A model is an abstract view of a system that ignores system details. Complementary system
models can be developed to show the systems context, interactions, structure and behavior.
Context models show how a system that is being modeled is positioned in an environment with
other systems and processes.
Use case diagrams and sequence diagrams are used to describe the interactions between users
and systems in the system being designed. Use cases describe interactions between a system
and external actors; sequence diagrams add more information to these by showing interactions
between system objects.
Structural models show the organization and architecture of a system. Class diagrams are used
to define the static structure of classes in a system and their associations.
CHAPTER 5 SYSTEM MODELING 40
Key points
Behavioral models are used to describe the dynamic behavior of an executing system.
This behavior can be modeled from the perspective of the data processed by the
system, or by the events that stimulate responses from a system.
Activity diagrams may be used to model the processing of data, where each activity
represents one process step.
CHAPTER 5 SYSTEM MODELING 41

More Related Content

Similar to Lecture 17 -18 - Sequence Diagram - Class Diagram.pptx (20)

Uml lecture
Uml lectureUml lecture
Uml lecture
Inocentshuja Ahmad
UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software Engineering
Amit Singh
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Aravinth NSP
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Sudarsun Santhiappan
Uml Omg Fundamental Certification 5
Uml Omg Fundamental Certification 5Uml Omg Fundamental Certification 5
Uml Omg Fundamental Certification 5
Ricardo Quintero
UML Chart Designing Methods - Lecture.pptx
UML Chart Designing Methods - Lecture.pptxUML Chart Designing Methods - Lecture.pptx
UML Chart Designing Methods - Lecture.pptx
lankanking4
Cs8592 ooad unit 3
Cs8592 ooad unit 3Cs8592 ooad unit 3
Cs8592 ooad unit 3
VADUGANATHAND1
Cs8592 ooad unit 3
Cs8592 ooad unit 3Cs8592 ooad unit 3
Cs8592 ooad unit 3
MAYILVELKUMARPONNUSA
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
Mukesh Tekwani
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
anguraju1
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
Raj Thilak S
Sda 7
Sda   7Sda   7
Sda 7
AmberMughal5
CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III
pkaviya
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.ppt
ChishaleFriday
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx
RokaKaram
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
Creately
432
432432
432
Sushath SimplytheBest
CHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptCHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.ppt
NgoHuuNhan1
Intro to UML 2
Intro to UML 2Intro to UML 2
Intro to UML 2
rchakra
Umldiagram
UmldiagramUmldiagram
Umldiagram
pavandeep11
UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software Engineering
Amit Singh
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Aravinth NSP
Uml Omg Fundamental Certification 5
Uml Omg Fundamental Certification 5Uml Omg Fundamental Certification 5
Uml Omg Fundamental Certification 5
Ricardo Quintero
UML Chart Designing Methods - Lecture.pptx
UML Chart Designing Methods - Lecture.pptxUML Chart Designing Methods - Lecture.pptx
UML Chart Designing Methods - Lecture.pptx
lankanking4
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
Mukesh Tekwani
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
anguraju1
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
Raj Thilak S
CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III
pkaviya
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.ppt
ChishaleFriday
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx
RokaKaram
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
Creately
CHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptCHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.ppt
NgoHuuNhan1
Intro to UML 2
Intro to UML 2Intro to UML 2
Intro to UML 2
rchakra

Recently uploaded (20)

Mate, a short story by Kate Grenvile.pptx
Mate, a short story by Kate Grenvile.pptxMate, a short story by Kate Grenvile.pptx
Mate, a short story by Kate Grenvile.pptx
Liny Jenifer
TPR Data strategy 2025 (1).pdf Data strategy
TPR Data strategy 2025 (1).pdf Data strategyTPR Data strategy 2025 (1).pdf Data strategy
TPR Data strategy 2025 (1).pdf Data strategy
Henry Tapper
N.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity BriefingN.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity Briefing
Mebane Rash
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
How to use Init Hooks in Odoo 18 - Odoo 際際滷s
How to use Init Hooks in Odoo 18 - Odoo 際際滷sHow to use Init Hooks in Odoo 18 - Odoo 際際滷s
How to use Init Hooks in Odoo 18 - Odoo 際際滷s
Celine George
Principle and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby BasnetPrinciple and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby Basnet
Boby Basnet
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
A PPT Presentation on The Princess and the God: A tale of ancient India  by A...A PPT Presentation on The Princess and the God: A tale of ancient India  by A...
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
Beena E S
Computer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network LayerComputer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network Layer
Murugan146644
Useful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷sUseful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷s
Celine George
How to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of SaleHow to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of Sale
Celine George
The Broccoli Dog's inner voice (look A)
The Broccoli Dog's inner voice  (look A)The Broccoli Dog's inner voice  (look A)
The Broccoli Dog's inner voice (look A)
merasan
How to Manage Putaway Rule in Odoo 17 Inventory
How to Manage Putaway Rule in Odoo 17 InventoryHow to Manage Putaway Rule in Odoo 17 Inventory
How to Manage Putaway Rule in Odoo 17 Inventory
Celine George
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
Research & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptxResearch & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptx
Dr. Sarita Anand
How to Modify Existing Web Pages in Odoo 18
How to Modify Existing Web Pages in Odoo 18How to Modify Existing Web Pages in Odoo 18
How to Modify Existing Web Pages in Odoo 18
Celine George
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir DotanThe Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
History of Stoke Newington
Rass MELAI : an Internet MELA Quiz Prelims - El Dorado 2025
Rass MELAI : an Internet MELA Quiz Prelims - El Dorado 2025Rass MELAI : an Internet MELA Quiz Prelims - El Dorado 2025
Rass MELAI : an Internet MELA Quiz Prelims - El Dorado 2025
Conquiztadors- the Quiz Society of Sri Venkateswara College
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷sHow to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
Celine George
Modeling-Simple-Equation-Using-Bar-Models.pptx
Modeling-Simple-Equation-Using-Bar-Models.pptxModeling-Simple-Equation-Using-Bar-Models.pptx
Modeling-Simple-Equation-Using-Bar-Models.pptx
maribethlacno2
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
Mate, a short story by Kate Grenvile.pptx
Mate, a short story by Kate Grenvile.pptxMate, a short story by Kate Grenvile.pptx
Mate, a short story by Kate Grenvile.pptx
Liny Jenifer
TPR Data strategy 2025 (1).pdf Data strategy
TPR Data strategy 2025 (1).pdf Data strategyTPR Data strategy 2025 (1).pdf Data strategy
TPR Data strategy 2025 (1).pdf Data strategy
Henry Tapper
N.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity BriefingN.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity Briefing
Mebane Rash
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
How to use Init Hooks in Odoo 18 - Odoo 際際滷s
How to use Init Hooks in Odoo 18 - Odoo 際際滷sHow to use Init Hooks in Odoo 18 - Odoo 際際滷s
How to use Init Hooks in Odoo 18 - Odoo 際際滷s
Celine George
Principle and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby BasnetPrinciple and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby Basnet
Boby Basnet
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
A PPT Presentation on The Princess and the God: A tale of ancient India  by A...A PPT Presentation on The Princess and the God: A tale of ancient India  by A...
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
Beena E S
Computer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network LayerComputer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network Layer
Murugan146644
Useful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷sUseful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷s
Celine George
How to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of SaleHow to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of Sale
Celine George
The Broccoli Dog's inner voice (look A)
The Broccoli Dog's inner voice  (look A)The Broccoli Dog's inner voice  (look A)
The Broccoli Dog's inner voice (look A)
merasan
How to Manage Putaway Rule in Odoo 17 Inventory
How to Manage Putaway Rule in Odoo 17 InventoryHow to Manage Putaway Rule in Odoo 17 Inventory
How to Manage Putaway Rule in Odoo 17 Inventory
Celine George
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
Research & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptxResearch & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptx
Dr. Sarita Anand
How to Modify Existing Web Pages in Odoo 18
How to Modify Existing Web Pages in Odoo 18How to Modify Existing Web Pages in Odoo 18
How to Modify Existing Web Pages in Odoo 18
Celine George
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir DotanThe Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
History of Stoke Newington
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷sHow to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
Celine George
Modeling-Simple-Equation-Using-Bar-Models.pptx
Modeling-Simple-Equation-Using-Bar-Models.pptxModeling-Simple-Equation-Using-Bar-Models.pptx
Modeling-Simple-Equation-Using-Bar-Models.pptx
maribethlacno2
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1

Lecture 17 -18 - Sequence Diagram - Class Diagram.pptx

  • 1. CHAPTER 5 SYSTEM MODELING Software Engineering LECTURE 17: SEQUENCE DIAGRAM AND CLASS DIAGRAM 1
  • 2. Sequence Diagram CHAPTER 5 SYSTEM MODELING 2
  • 3. Sequence Diagrams A sequence diagram shows the sequence of interactions that take place during a particular use case. You read them from top to bottom to see the order of the actions that take place. Issue an e-book from a library Lookup a catalog Request for issue Download the ebook
  • 4. Sequence Diagram Example :Library User Ecat: Catalog Lookup Issue Display :Library Item Lib1: NetServer Issue licence Accept licence Compress Deliver
  • 5. Sequence Diagram Elements: Targets Targets: Objects as well as classes can be targets on a sequence diagram, which means that messages can be sent to them. A target is displayed as a rectangle with some text in it. Below the target, its lifeline extends for as long as the target exists. The lifeline is displayed as a vertical dashed line.
  • 6. Targets: Objects Objects Basic notation for an object is: Both name and type are optional but atleast one should be present
  • 7. Targets: Objects As with any UML-element, you can add a stereotype to a target.
  • 8. Targets: Objects An object should be named only if at least one of the following applies You want to refer to it during the interaction as a message parameter or return value You don't mention its type There are other anonymous objects of the same type and giving them names is the only way to differentiate them
  • 9. Targets: MultiObjects When you want to show how a client interacts with the elements of a collection, you can use a multiobject. Its basic notation is Again, a name and/or type can be specified. Note however that the 'Type' part designates the type of the elements and not the type of the collection itself.
  • 10. Targets: Class A basic notation for class is: Only class messages (e.g. shared or static methods in some programming languages) can be sent to a class. Note that the text of a class is not underlined, which is how you can distinguish it from an object.
  • 11. Sequence Diagram Elements: Messages When a target sends a message to another target, it is shown as an arrow between their lifelines. The arrow originates at the sender and ends at the receiver. Near the arrow, the name and parameters of the message are shown. Messages can be of two types Synchronous Messages Asynchronous Messages
  • 12. Messages: Synchronous Messages A synchronous message is used when the sender waits until the receiver has finished processing the message, only then does the caller continue (i.e. a blocking call). Most method calls in object- oriented programming languages are synchronous. A closed and filled arrowhead signifies that the message is sent synchronously.
  • 13. Messages: Synchronous Messages The white rectangles on a lifeline are called activations and indicate that an object is responding to a message. It starts when the message is received and ends when the object is done handling the message. If you want to show that the receiver has finished processing the message and returns control to the sender, draw a dashed arrow from receiver to sender. Optionally, a value that the receiver returns to the sender can be placed near the return arrow.
  • 14. Messages: Asynchronous Messages With an asynchronous message, the sender does not wait for the receiver to finish processing the message, it continues immediately. Messages sent to a receiver in another process or calls that start a new thread are examples of asynchronous messages. An open arrowhead is used to indicate that a message is sent asynchrously.
  • 15. Targets Creation and Destruction Targets that exist at the start of an interaction are placed at the top of the diagram. Any targets that are created during the interaction are placed further down the diagram, at their time of creation.
  • 16. Conditional Interaction A message can include a guard, which signifies that the message is only sent if a certain condition is met. The guard is simply that condition between brackets. Sending out several messages on the same condition:
  • 17. Alternative Interaction If you want to show several alternative interactions, use an 'alt' combined fragment. The combined fragment contains an operand for each alternative. Each alternative has a guard and contains the interaction that occurs when the condition for that guard is met.
  • 18. Repeated Interaction When a message is prefixed with an asterisk (the '*'-symbol), it means that the message is sent repeatedly. A guard indicates the condition that determines whether or not the message should be sent (again). As long as the condition holds, the message is repeated.
  • 19. Repeated Interaction A more common use of repetition is sending the same message to different elements in a collection. In such a scenario, the receiver of the repeated message is a multiobject and the guard indicates the condition that controls the repetition.
  • 20. Example To give an exam, an instructor first notifies the students of the exam date and the material to be covered. She then prepares the exam paper (with sample solutions), gets it copied to produce enough copies for the class, and hands it out to students on the designated time and location. The students write their answers to exam questions and hand in their papers to the instructor. The instructor then gives the exam papers to the TAs, along with sample solutions to each question, and gets them to mark it. She then records all marks and returns the papers to the students. Draw a sequence diagram that represents this process. Make sure to show when is each actor participating in the process. Also, show the operation that is carried out during each interaction, and what its arguments are
  • 22. Structural models CHAPTER 5 SYSTEM MODELING 22 30/10/2014
  • 23. Structural Models Structural models of software display the organization of a system in terms of components that make up the system and their relationship Structural models may be Static Modelsstructure of the system Dynamic Models-- structure of the system when executing Today's focus will be on class diagrams for modelling the static structure of the program
  • 24. Class Diagrams Class diagrams are used when developing an object-oriented system model to show the classes in a system and the associations between these classes. An association is a link between classes that indicates that there is some relationship between these classes. When you are developing models during the early stages of the software engineering process, objects represent something in the real world, such as a patient, a prescription, doctor, etc. A implementation is developed you usually need to define additional implementation objects Today we will focus on modeling real world objects as part of the requirement or early stage software design.
  • 25. UML Class Diagrams Class diagrams in UML can be expressed at different level of detail. At the first stage of developing a model, look at the world and identify the essential objects and represent them as class. The simplest way is to write the name of the class in a box Patient
  • 26. UML Class Diagrams (cont) You can also note the existence of an association by drawing a line between the classes You can annotate the relationship to show how many objects are involved in the association Patient PatientRecord Patient PatientRecord 1 1
  • 27. Class Associations You can name the relationships and other multiplicities of objects in any association are also possible as shown here: Patient Doctor * 1 ReferredBy Patient Medical Condition 1..* 1..* Diagnosed With
  • 28. Adding Details to class diagrams When showing the association between the classes it is convenient to represent these classes in the simplest possible way. To define them in more detail you add information about their attributes and operations Patient Name Registration Number Blood Group medicines getPatientName() addMedicine() RemoveMedicine() ...
  • 31. Aggregation and Composition Library Books 1 .. * HumanBody Muscles 1 .. *
  • 34. Noun Identification: A library System
  • 35. Noun Identification: A library System
  • 39. A Possible Class Diagram
  • 40. Key points A model is an abstract view of a system that ignores system details. Complementary system models can be developed to show the systems context, interactions, structure and behavior. Context models show how a system that is being modeled is positioned in an environment with other systems and processes. Use case diagrams and sequence diagrams are used to describe the interactions between users and systems in the system being designed. Use cases describe interactions between a system and external actors; sequence diagrams add more information to these by showing interactions between system objects. Structural models show the organization and architecture of a system. Class diagrams are used to define the static structure of classes in a system and their associations. CHAPTER 5 SYSTEM MODELING 40
  • 41. Key points Behavioral models are used to describe the dynamic behavior of an executing system. This behavior can be modeled from the perspective of the data processed by the system, or by the events that stimulate responses from a system. Activity diagrams may be used to model the processing of data, where each activity represents one process step. CHAPTER 5 SYSTEM MODELING 41