SlideShare a Scribd company logo
By
            Nadeem Mahmood
Department of Computer Science
         University Of Karachi
Interaction Diagrams


Interaction diagrams describe exemplary how
 groups of objects collaborate in some behavior.
An interaction diagram typically captures the
 behavior of a single use case.
Interaction diagrams do not capture the complete
 behavior, only typical scenarios.
Types of Interaction Diagrams
 There are two types of interaction diagrams:
Sequence diagrams emphasize the order or
 concurrency of the interactions.
Collaboration diagrams emphasize the interacting
 objects.
Behavior of the “order” use case:
A customer orders several products.
The (sub-)orders (“order lines”) for each product are prepared
separately.
For each product check the stock.
• If the product is in stock, remove requested amount from stock.
• If the product stock falls below a predefined level, reorder it.
Object
Object naming:
   syntax: [instanceName][:className]
                                                         myBirthdy
                                                           :Date
   Name classes consistently with your class diagram
    (same classes).
   Include instance names when objects are referred
    to in messages or when several objects of the same
    type exist in the diagram.
The Life-Line represents the object’s life
 during the interaction
Messages
An interaction between two objects is performed as
 a message sent from one object to another (simple
 operation call, Signaling, RPC)
If object obj1 sends a message to another object obj2
 some link must exist between those two objects
 (dependency, same objects)
Messages (Cont.)
A message is represented by an arrow between the
 life lines of two objects.
   Self calls are also allowed
   The time required by the receiver object to process the
    message is denoted by an activation-box.
A message is labeled at minimum with the message
 name.
   Arguments and control information (conditions, iteration)
    may be included.
Return Values
Optionally indicated using a dashed arrow with a
 label indicating the return value.
  Don’t model a return value when it is obvious what is
   being returned, e.g. getTotal()
  Model a return value only when you need to refer to it
   elsewhere, e.g. as a parameter passed in another
   message.
  Prefer modeling return values as part of a method
   invocation, e.g. ok = isValid()
Synchronous Messages
Nested flow of control, typically implemented as an
 operation call.
  The routine that handles the message is completed
    before the caller resumes execution.


                   :A                       :B

                        doYouUnderstand()

                                                   return
   Caller
                              yes                (optional)
  Blocked
Object Creation
An object may create another object via a
 <<create>> message.


                                            Preferred
      :A                  :B   :A

           <<create>>               <<create>>
                                                 :B


            Constructor
Object Destruction
An object may destroy another object via a
 <<destroy>> message.
   An object may destroy itself.
   Avoid modeling object destruction unless memory
    management is critical.


                                    :A             :B
                                         <<destroy>>
Why not just code it?
 Sequence diagrams can be somewhat close to the code
     level. So why not just code up that algorithm rather than
     drawing it as a sequence diagram?
    a good sequence diagram is still a bit above the level of the real code (not
     EVERY line of code is drawn on diagram)
    sequence diagrams are language-agnostic (can be implemented in many
     different languages
    non-coders can do sequence diagrams
    easier to do sequence diagrams as a team
    can see many objects/classes at a time on same page (visual bandwidth)




17
Lifetime of objects
creation: arrow with 'new'
 written above it
  notice that an object created
       after the start of the scenario
       appears lower than the
       others

deletion: an X at bottom of
 object's lifeline
  Java doesn't explicitly delete
       objects; they fall out of scope
       and are garbage-collected



  18
Indicating selection and loops
frame: box around part of a sequence diagram to
     indicate selection or loop
     if -> (opt) [condition]
     if/else -> (alt) [condition], separated by horiz. dashed
      line
     loop -> (loop) [condition or items to loop over]
                                opt   [balance 0]
                                             <>                alt      [balance 100 ]
                                                                               < .00


                                                                     [balance 100 ]
                                                                            >= .00




                                                loop   [balance 0]
                                                              <




19
Reference: Object-Oriented Analysis and Design
J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
Reference: Object-Oriented Analysis and Design
J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
Sequence diag. from use case




26

More Related Content

What's hot

Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
Shruti Dalela
 
Sequence Diagram
Sequence DiagramSequence Diagram
Lecture#08 sequence diagrams
Lecture#08 sequence diagramsLecture#08 sequence diagrams
Lecture#08 sequence diagramsbabak danyal
 
Sequence diagrame
Sequence diagrameSequence diagrame
Sequence diagrame
City University
 
Class diagram presentation
Class diagram presentationClass diagram presentation
Class diagram presentation
SayedFarhan110
 
Uml deployment diagram
Uml deployment diagramUml deployment diagram
Uml deployment diagramAsraa Batool
 
Data Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence DiagramData Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence Diagram
Hamna Shahzad
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
Rahul Pola
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
anasz3z3
 
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction
Object-Oriented Analysis & Design (OOAD) Domain Modeling IntroductionDang Tuan
 
Deployment Diagram
Deployment DiagramDeployment Diagram
Deployment Diagram
University of Texas at Dallas
 
UML and Software Modeling Tools.pptx
UML and Software Modeling Tools.pptxUML and Software Modeling Tools.pptx
UML and Software Modeling Tools.pptx
Nwabueze Obioma
 
UNIFIED MODELING LANGUAGE
UNIFIED MODELING LANGUAGEUNIFIED MODELING LANGUAGE
UNIFIED MODELING LANGUAGE
Raval Chirag
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
Ahllen Javier
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
AMITJain879
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class DiagramNiloy Rocker
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
Preeti Mishra
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
barney92
 
Uml with detail
Uml with detailUml with detail
Uml with detail
Hamza Khan
 

What's hot (20)

Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
 
Sequence Diagram
Sequence DiagramSequence Diagram
Sequence Diagram
 
Lecture#08 sequence diagrams
Lecture#08 sequence diagramsLecture#08 sequence diagrams
Lecture#08 sequence diagrams
 
Sequence diagrame
Sequence diagrameSequence diagrame
Sequence diagrame
 
Class diagram presentation
Class diagram presentationClass diagram presentation
Class diagram presentation
 
Uml deployment diagram
Uml deployment diagramUml deployment diagram
Uml deployment diagram
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
 
Data Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence DiagramData Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence Diagram
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
 
Deployment Diagram
Deployment DiagramDeployment Diagram
Deployment Diagram
 
UML and Software Modeling Tools.pptx
UML and Software Modeling Tools.pptxUML and Software Modeling Tools.pptx
UML and Software Modeling Tools.pptx
 
UNIFIED MODELING LANGUAGE
UNIFIED MODELING LANGUAGEUNIFIED MODELING LANGUAGE
UNIFIED MODELING LANGUAGE
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class Diagram
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Uml with detail
Uml with detailUml with detail
Uml with detail
 

Similar to Ooad sequence diagram lecture

Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Introduction to OOA and UML - Part 2
Introduction to OOA and UML - Part 2 Introduction to OOA and UML - Part 2
Introduction to OOA and UML - Part 2
Shwetha-BA
 
06 ooad uml-07
06 ooad uml-0706 ooad uml-07
06 ooad uml-07Niit Care
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
Divyam Pateriya
 
Funtional Reactive Programming with Examples in Scala + GWT
Funtional Reactive Programming with Examples in Scala + GWTFuntional Reactive Programming with Examples in Scala + GWT
Funtional Reactive Programming with Examples in Scala + GWT
Vasil Remeniuk
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
Workhorse Computing
 
Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-
Taymoor Nazmy
 
Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3
Ali Raza Zaidi
 
Pertemuan 6-2-sequence-diagram
Pertemuan 6-2-sequence-diagramPertemuan 6-2-sequence-diagram
Pertemuan 6-2-sequence-diagramAbi Bobon
 
Ood Post1
Ood Post1Ood Post1
Ood Post1
Rajesh Kumar
 
From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)
Jordi Cabot
 
What's New In Python 2.6
What's New In Python 2.6What's New In Python 2.6
What's New In Python 2.6
Richard Jones
 
Cpprm
CpprmCpprm
Cpprm
Shawne Lee
 
Programming in Scala - Lecture Four
Programming in Scala - Lecture FourProgramming in Scala - Lecture Four
Programming in Scala - Lecture Four
Angelo Corsaro
 
4. UML
4. UML4. UML
While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...
bhargavi804095
 
11-Classes.ppt
11-Classes.ppt11-Classes.ppt
11-Classes.ppt
basavaraj852759
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
Julie Iskander
 
Algorithms: I
Algorithms: IAlgorithms: I
Algorithms: I
Joyjit Choudhury
 

Similar to Ooad sequence diagram lecture (20)

Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Introduction to OOA and UML - Part 2
Introduction to OOA and UML - Part 2 Introduction to OOA and UML - Part 2
Introduction to OOA and UML - Part 2
 
06 ooad uml-07
06 ooad uml-0706 ooad uml-07
06 ooad uml-07
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
Funtional Reactive Programming with Examples in Scala + GWT
Funtional Reactive Programming with Examples in Scala + GWTFuntional Reactive Programming with Examples in Scala + GWT
Funtional Reactive Programming with Examples in Scala + GWT
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-
 
Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3
 
Pertemuan 6-2-sequence-diagram
Pertemuan 6-2-sequence-diagramPertemuan 6-2-sequence-diagram
Pertemuan 6-2-sequence-diagram
 
Ood Post1
Ood Post1Ood Post1
Ood Post1
 
From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)
 
What's New In Python 2.6
What's New In Python 2.6What's New In Python 2.6
What's New In Python 2.6
 
Cpprm
CpprmCpprm
Cpprm
 
Programming in Scala - Lecture Four
Programming in Scala - Lecture FourProgramming in Scala - Lecture Four
Programming in Scala - Lecture Four
 
4. UML
4. UML4. UML
4. UML
 
While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...
 
11-Classes.ppt
11-Classes.ppt11-Classes.ppt
11-Classes.ppt
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Algorithms: I
Algorithms: IAlgorithms: I
Algorithms: I
 

More from asimnawaz54

Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceasimnawaz54
 
Lecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inferenceLecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inferenceasimnawaz54
 
Expert systems with applications
Expert systems with applicationsExpert systems with applications
Expert systems with applicationsasimnawaz54
 
Establishing knowledge base
Establishing knowledge baseEstablishing knowledge base
Establishing knowledge baseasimnawaz54
 
Designing the expert system
Designing the expert systemDesigning the expert system
Designing the expert systemasimnawaz54
 
1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-main1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-mainasimnawaz54
 
Packet switching
Packet switchingPacket switching
Packet switchingasimnawaz54
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switchingasimnawaz54
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switchingasimnawaz54
 
Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocolasimnawaz54
 
Address resolution protocol
Address resolution protocolAddress resolution protocol
Address resolution protocolasimnawaz54
 
Address resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocolAddress resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocolasimnawaz54
 
Requirements analysis
Requirements analysisRequirements analysis
Requirements analysis
asimnawaz54
 
Advanced software engineering lab 2
Advanced software engineering lab 2Advanced software engineering lab 2
Advanced software engineering lab 2
asimnawaz54
 
Object oriented analysis lab1
Object oriented analysis lab1Object oriented analysis lab1
Object oriented analysis lab1asimnawaz54
 

More from asimnawaz54 (17)

Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inference
 
Lecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inferenceLecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inference
 
Expert systems with applications
Expert systems with applicationsExpert systems with applications
Expert systems with applications
 
Establishing knowledge base
Establishing knowledge baseEstablishing knowledge base
Establishing knowledge base
 
Designing the expert system
Designing the expert systemDesigning the expert system
Designing the expert system
 
1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-main1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-main
 
Packet switching
Packet switchingPacket switching
Packet switching
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switching
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switching
 
Ipv6up
Ipv6upIpv6up
Ipv6up
 
Ipv4
Ipv4Ipv4
Ipv4
 
Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocol
 
Address resolution protocol
Address resolution protocolAddress resolution protocol
Address resolution protocol
 
Address resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocolAddress resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocol
 
Requirements analysis
Requirements analysisRequirements analysis
Requirements analysis
 
Advanced software engineering lab 2
Advanced software engineering lab 2Advanced software engineering lab 2
Advanced software engineering lab 2
 
Object oriented analysis lab1
Object oriented analysis lab1Object oriented analysis lab1
Object oriented analysis lab1
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 

Ooad sequence diagram lecture

  • 1. By Nadeem Mahmood Department of Computer Science University Of Karachi
  • 2. Interaction Diagrams Interaction diagrams describe exemplary how groups of objects collaborate in some behavior. An interaction diagram typically captures the behavior of a single use case. Interaction diagrams do not capture the complete behavior, only typical scenarios.
  • 3. Types of Interaction Diagrams There are two types of interaction diagrams: Sequence diagrams emphasize the order or concurrency of the interactions. Collaboration diagrams emphasize the interacting objects.
  • 4.
  • 5. Behavior of the “order” use case: A customer orders several products. The (sub-)orders (“order lines”) for each product are prepared separately. For each product check the stock. • If the product is in stock, remove requested amount from stock. • If the product stock falls below a predefined level, reorder it.
  • 6. Object Object naming:  syntax: [instanceName][:className] myBirthdy :Date  Name classes consistently with your class diagram (same classes).  Include instance names when objects are referred to in messages or when several objects of the same type exist in the diagram. The Life-Line represents the object’s life during the interaction
  • 7. Messages An interaction between two objects is performed as a message sent from one object to another (simple operation call, Signaling, RPC) If object obj1 sends a message to another object obj2 some link must exist between those two objects (dependency, same objects)
  • 8. Messages (Cont.) A message is represented by an arrow between the life lines of two objects.  Self calls are also allowed  The time required by the receiver object to process the message is denoted by an activation-box. A message is labeled at minimum with the message name.  Arguments and control information (conditions, iteration) may be included.
  • 9. Return Values Optionally indicated using a dashed arrow with a label indicating the return value. Don’t model a return value when it is obvious what is being returned, e.g. getTotal() Model a return value only when you need to refer to it elsewhere, e.g. as a parameter passed in another message. Prefer modeling return values as part of a method invocation, e.g. ok = isValid()
  • 10. Synchronous Messages Nested flow of control, typically implemented as an operation call. The routine that handles the message is completed before the caller resumes execution. :A :B doYouUnderstand() return Caller yes (optional) Blocked
  • 11. Object Creation An object may create another object via a <<create>> message. Preferred :A :B :A <<create>> <<create>> :B Constructor
  • 12. Object Destruction An object may destroy another object via a <<destroy>> message.  An object may destroy itself.  Avoid modeling object destruction unless memory management is critical. :A :B <<destroy>>
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Why not just code it? Sequence diagrams can be somewhat close to the code level. So why not just code up that algorithm rather than drawing it as a sequence diagram?  a good sequence diagram is still a bit above the level of the real code (not EVERY line of code is drawn on diagram)  sequence diagrams are language-agnostic (can be implemented in many different languages  non-coders can do sequence diagrams  easier to do sequence diagrams as a team  can see many objects/classes at a time on same page (visual bandwidth) 17
  • 18. Lifetime of objects creation: arrow with 'new' written above it notice that an object created after the start of the scenario appears lower than the others deletion: an X at bottom of object's lifeline Java doesn't explicitly delete objects; they fall out of scope and are garbage-collected 18
  • 19. Indicating selection and loops frame: box around part of a sequence diagram to indicate selection or loop if -> (opt) [condition] if/else -> (alt) [condition], separated by horiz. dashed line loop -> (loop) [condition or items to loop over] opt [balance 0] <> alt [balance 100 ] < .00 [balance 100 ] >= .00 loop [balance 0] < 19
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Reference: Object-Oriented Analysis and Design J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
  • 25. Reference: Object-Oriented Analysis and Design J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
  • 26. Sequence diag. from use case 26