SlideShare uma empresa Scribd logo
1 de 26
OOAD
Sequence Diagrams
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.
Role of Interaction Diagrams in UML
Interaction Diagrams and Use Cases




   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:
                                                          myBirthdy
       syntax: [instanceName][:className]
                                                            :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 obj sends a message to another
               1
  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
 Nestedflow 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>>
Sequence Model (1)
Sequence Model (2)
Sequence Model (3)
Sequence Model (4)
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 opt [balance 0]
                                        items to loop over] [balance 100.00]
                                                 <>      alt       <



                                                                         [balance 100 ]
                                                                                >= .00




                                                    loop   [balance 0]
                                                                  <




19
Concurrent Processes and Activations
Concurrency in Sequence Diagrams (1)
Concurrency in Sequence Diagrams (2)
Concurrency in Sequence Diagrams (3)
A Successful Bank Transaction




 Reference: Object-Oriented Analysis and Design
 J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
A Failing Bank Transaction




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




26

Mais conteúdo relacionado

Mais procurados

Lecture#08 sequence diagrams
Lecture#08 sequence diagramsLecture#08 sequence diagrams
Lecture#08 sequence diagrams
babak danyal
 
Uml Activity Diagram
Uml Activity DiagramUml Activity Diagram
Uml Activity Diagram
Niloy Rocker
 
Slide 4 Interaction Diagram
Slide 4 Interaction DiagramSlide 4 Interaction Diagram
Slide 4 Interaction Diagram
Niloy Rocker
 
UML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionUML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussion
CherryBerry2
 

Mais procurados (20)

Lecture#08 sequence diagrams
Lecture#08 sequence diagramsLecture#08 sequence diagrams
Lecture#08 sequence diagrams
 
Lecture6 activity diagrams
Lecture6 activity diagramsLecture6 activity diagrams
Lecture6 activity diagrams
 
Class diagrams
Class diagramsClass diagrams
Class diagrams
 
SAD11 - Sequence Diagrams
SAD11 - Sequence DiagramsSAD11 - Sequence Diagrams
SAD11 - Sequence Diagrams
 
Diagrams
DiagramsDiagrams
Diagrams
 
Class diagrams
Class diagramsClass diagrams
Class diagrams
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbols
 
Uml Activity Diagram
Uml Activity DiagramUml Activity Diagram
Uml Activity Diagram
 
Slide 4 Interaction Diagram
Slide 4 Interaction DiagramSlide 4 Interaction Diagram
Slide 4 Interaction Diagram
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Class Diagram
Class DiagramClass Diagram
Class Diagram
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
 
Interaction overview and Profile UML Diagrams
Interaction overview and Profile UML DiagramsInteraction overview and Profile UML Diagrams
Interaction overview and Profile UML Diagrams
 
Object diagram
Object diagramObject diagram
Object diagram
 
Activity Diagram
Activity DiagramActivity Diagram
Activity Diagram
 
UML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionUML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussion
 
UML Class Diagram Notation
UML Class Diagram NotationUML Class Diagram Notation
UML Class Diagram Notation
 

Destaque

Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Haitham El-Ghareeb
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class Diagram
Niloy Rocker
 

Destaque (20)

Sequence diagram- UML diagram
Sequence diagram- UML diagramSequence diagram- UML diagram
Sequence diagram- UML diagram
 
Use case Diagram and Sequence Diagram
Use case Diagram and Sequence DiagramUse case Diagram and Sequence Diagram
Use case Diagram and Sequence Diagram
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Practicing 2d drawing primitives
Practicing 2d drawing primitivesPracticing 2d drawing primitives
Practicing 2d drawing primitives
 
34. uml
34. uml34. uml
34. uml
 
Setting up your first open gl program
Setting up your first open gl programSetting up your first open gl program
Setting up your first open gl program
 
الأستقبال في مصرف الدم Reception department ‫‬
الأستقبال في مصرف الدم Reception department ‫‬الأستقبال في مصرف الدم Reception department ‫‬
الأستقبال في مصرف الدم Reception department ‫‬
 
how to write your project documentation
how to write your project documentationhow to write your project documentation
how to write your project documentation
 
Web 1.0, 2.0, 3.0
Web 1.0, 2.0, 3.0Web 1.0, 2.0, 3.0
Web 1.0, 2.0, 3.0
 
قسم التبرع بالدم ‫‬ blood donation department
قسم التبرع بالدم ‫‬  blood donation departmentقسم التبرع بالدم ‫‬  blood donation department
قسم التبرع بالدم ‫‬ blood donation department
 
Lecture07
Lecture07Lecture07
Lecture07
 
Blood bank
Blood bankBlood bank
Blood bank
 
Blood donation ppt
Blood donation pptBlood donation ppt
Blood donation ppt
 
Data Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence DiagramData Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence Diagram
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class Diagram
 
Blood Bank Management System
Blood Bank Management SystemBlood Bank Management System
Blood Bank Management System
 
Activity diagram-UML diagram
Activity diagram-UML diagramActivity diagram-UML diagram
Activity diagram-UML diagram
 
An Online Car Parking System (Features & Diagrams Only)
An Online Car Parking System (Features & Diagrams Only)An Online Car Parking System (Features & Diagrams Only)
An Online Car Parking System (Features & Diagrams Only)
 
Hotel management system
Hotel management systemHotel management system
Hotel management system
 

Semelhante a Ooad sequence diagram lecture

Pertemuan 6-2-sequence-diagram
Pertemuan 6-2-sequence-diagramPertemuan 6-2-sequence-diagram
Pertemuan 6-2-sequence-diagram
Abi Bobon
 
06 ooad uml-07
06 ooad uml-0706 ooad uml-07
06 ooad uml-07
Niit Care
 
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGNOOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
KalyaniLokhande5
 
7. sequence and collaboration diagrams
7. sequence and collaboration diagrams7. sequence and collaboration diagrams
7. sequence and collaboration diagrams
APU
 

Semelhante a Ooad sequence diagram lecture (20)

Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-Software Engineering Lec 7-uml-
Software Engineering Lec 7-uml-
 
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
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
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
 
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
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
06 ooad uml-07
06 ooad uml-0706 ooad uml-07
06 ooad uml-07
 
Visual c sharp
Visual c sharpVisual c sharp
Visual c sharp
 
Cpprm
CpprmCpprm
Cpprm
 
UML and You
UML and YouUML and You
UML and You
 
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGNOOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With Scala
 
7. sequence and collaboration diagrams
7. sequence and collaboration diagrams7. sequence and collaboration diagrams
7. sequence and collaboration diagrams
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
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
 
4. UML
4. UML4. UML
4. UML
 
UML.pptx
UML.pptxUML.pptx
UML.pptx
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 

Ooad sequence diagram lecture

  • 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. Role of Interaction Diagrams in UML
  • 5. Interaction Diagrams and Use Cases 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: myBirthdy  syntax: [instanceName][:className] :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 obj sends a message to another 1 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  Nestedflow 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>>
  • 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 opt [balance 0] items to loop over] [balance 100.00] <> alt < [balance 100 ] >= .00 loop [balance 0] < 19
  • 21. Concurrency in Sequence Diagrams (1)
  • 22. Concurrency in Sequence Diagrams (2)
  • 23. Concurrency in Sequence Diagrams (3)
  • 24. A Successful Bank Transaction Reference: Object-Oriented Analysis and Design J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
  • 25. A Failing Bank Transaction Reference: Object-Oriented Analysis and Design J.W. Schmidt, F. Matthes, TU Hamburg-Harburg
  • 26. Sequence diag. from use case 26