1 Behavioral diagrams (2) Lecture p5 T120B029 2012 pavasario sem.

Slides:



Advertisements
Similar presentations
SEQUENCE DIAGRAM. UML diagrams There are many ways of organizing the UML diagrams. Can be organized as the fallowing: 1. Structural diagrams: to show.
Advertisements

System Sequence Diagrams
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
Interaction Diagrams Software Engineering BIT8. Interaction Diagrams  A series of diagrams describing the dynamic behavior of an object-oriented system.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 UML Sequence Diagrams  Used during system.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Sequence Diagrams By Zvika Gutterman Adam Carmi. Agenda Interaction Diagrams A First Look at Sequence Diagrams Objects Messages Control Information Examples.
Dynamic modeling using UML
Sequence Diagrams By Zvika Gutterman Adam Carmi. Sequence Diagrams2 Agenda Interaction Diagrams A First Look at Sequence Diagrams Objects Messages Control.
© Copyright Eliyahu Brutman Programming Techniques Course.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
SE-565 Software System Requirements More UML Diagrams.
Page 1 R Copyright © 1997 by Rational Software Corporation Analysis and Design with UML.
Object-Oriented Analysis and Design
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Chapter 7: The Object-Oriented Approach to Requirements
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
The Design Discipline.
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
Page 1 What is the UML? UML stands for Unified Modeling Language The UML combines the best of the best from – Data Modeling concepts (Entity Relationship.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Page 1  Copyright © 1997 by Rational Software Corporation Computer System Business Process Order Item Ship via “ Modeling captures essential parts of.
Page 1 R Copyright © 1998 by Rational Software Corporation Visual Modeling and the UML.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
Behavioral diagrams Lecture p4 T120B pavasario sem.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
Systems Analysis and Design in a Changing World, 3rd Edition
7 Systems Analysis and Design in a Changing World, Fifth Edition.
UML Review of diagram types. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson, and.
Collaboration Diagrams CSIS3600. What is a Collaboration Diagram Collaboration diagrams illustrate interactions between objects The collaboration diagram.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
1 An Introduction to UML Interaction (Sequence and Communication) Diagrams Georgia State University CIS 3300 Spring, 2009.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
1 The Unified Modeling Language. 2 The Unified Modeling Language (UML) is a standard language for writing software blueprints. The UML may be used to.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 19, 2001 UML.
Design Model Lecture p6 T120B pavasario sem.
Page 1 R Copyright © 1997 by Rational Software Corporation Analysis and Design with UML Presentation was downloaded (and is available for free) from Rational.
Using UML, Patterns, and Java Object-Oriented Software Engineering More on UML Note: Slides are adapted by Linda Sherrell from the Software Engineering.
(14-2) UML Instructor - Andrew O’Fallon CptS 122 (December 2, 2015) Washington State University.
Dynamic Models Sequence Diagrams Collaboration Diagrams Activity Diagrams.
Systems Analysis and Design in a Changing World, Fourth Edition
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
Chapter 3: Introducing the UML
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
1 7 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 7 The Object-Oriented Approach to Requirements.
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
1 IS 0020 Program Design and Software Tools Unified Modeling Language Lecture 13 April 13, 2005.
1 IS 0020 Program Design and Software Tools Unified Modeling Language Lecture 13 November 30, 2004.
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
Systems Analysis and Design in a Changing World, Fourth Edition
Chapter 2, Modeling with UML
UML Diagrams By Daniel Damaris Novarianto S..
Collaboration Diagrams
Unified Modeling Language
Introduction to Unified Modeling Language (UML)
UML Diagrams Jung Woo.
Sequence Diagrams.
Object Oriented Analysis and Design
The Unified Modeling Language
Unified Modeling Language
CIS 375 Bruce R. Maxim UM-Dearborn
CHAPTER 2 Object-Oriented Modeling Using UML (Continued)
CIS 375 Bruce R. Maxim UM-Dearborn
Presentation transcript:

1 Behavioral diagrams (2) Lecture p5 T120B pavasario sem.

2 Main processes of the team assignment requirements analysis design process codingtesting Used technique: UML use case diagrams UML activity diagrams Used technique: UML component diagrams, UML class diagrams, UML state diagrams UML sequence diagrams, UML activity diagrams Used languages: Java C++ … requirements document problem description design document T120B029

3 The Analysis Model analysis model:Model dynamic model:Model object model:Model functional model:Model use case diagram:View class diagram:View statechart diagram:View sequence diagram:View T120B029

4 Dynamic Models Statechart diagrams for complex behavior of objects Sequence diagrams for use cases –Although they contain redundant information (have textual flow of events with use cases) useful because they are more precise and will help the designers understand the system T120B029

5 Sequence Diagram Observations UML sequence diagram represent behavior in terms of interactions. Complement the class diagrams which represent structure. Useful to find participating objects. Time consuming to build but worth the investment. T120B029

6 Interaction diagrams Describe how groups of objects interact Typically describe the scenario of a single use case (or parts of it) Details how objects communicate with one another Two views: –Time-based (Sequence Diagram) –Organization-based (Collaboration Diagram) T120B029

7 Sequence diagrams Shows object interactions arranged in time sequence It focuses on –objects (and classes) –message exchange to carry out the scenarios functionality The objects are organized in an horizontal line and the events in a vertical time line T120B029

8 UML Sequence Diagrams Used during requirements analysis –To refine use case descriptions –to find additional objects (“participating objects”) Used during system design –to refine subsystem interfaces Classes are represented by columns Messages are represented by arrows Activations are represented by narrow rectangles selectZone() pickupChange() pickUpTicket() insertCoins() Passenger TicketMachine T120B029

9 Content of sequence diagrams Objects –they exchange messages among each other Messages –Synchronous: “call events,” denoted by the full arrow; Duration of synchronization should be indicated by activation bar or return arrow –Asynchronous: “signals,” denoted by a half arrow –There are also «create» and «destroy» messages T120B029

10 Asynchronous messages Do not block the caller Can do 3 things: –Create a new thread –Create a new object –Communicate with a thread that is already running T120B029

11 Notation example (simple version) Messages point from client to supplier : Professor CourseManager Math Section 1 : CourseOffering Add professor (Professor) Lifeline Message T120B029

12 Sequence diagram: Larger Example course form : CourseForm theManager : CurriculumManager aCourse : Course : Registrar 1 : set course info 2 : process 3 : add course 4 : > Object creation T120B029

13 UML Sequence Diagrams: Nested Messages The source of an arrow indicates the activation which sent the message An activation is as long as all nested activations selectZone() Passenger ZoneButton TarifScheduleDisplay lookupPrice(selection) displayPrice(price) price Dataflow …to be continued... T120B029

14 an Order Entry window an Order Line a Stock Item 1: prepare() 2: * prepare() 3: check() 4: [check = true] remove() 5: needsToReorder() Iteration Condition Self delegation Asynchronous Message Sequence diagrams: More details Activation a Reorder Item 6: [needsToReorder = true] > Return arrow T120B029

15 Complete example of sequence diagrams POS Login T120B029

16 Example of a transaction T120B029

17 About sequence diagrams and complexity KISS = keep it small and simple Diagrams are meant to make things clear Conditional logic –simple: add it to the diagram –complex: draw separate diagrams But always remember: messages do not travel without needing time T120B029

18 Proposed Exercises Use a sequence diagram to model how you receive the request to develop a new piece of code Use a sequence diagram to model how a basestation interacts with a cellphone Use a sequence diagram to represent how a cellular phone moves from cell to cell and handle roaming T120B029

19 Collaboration diagrams: Where are the boundaries? A boundary shapes communication between system and outside world –e.g. user interface or other system –Represent actors from use case diagrams It may be useful to show boundary classes in interaction diagrams: –capture interface requirements –do NOT show how the interface will be implemented T120B029

20 Collaboration diagrams Show how objects interacts with respect to organizational units (boundaries!) Sequence of messages determined by numbering –1, 2, 3, 4, ….. –1, 1.1, 1.2, 1.3, 2, 2.1, 2.1.1, 2.2, 3 (shows which operation calls which other operation) T120B029

21 Collaboration diagram basics : ProfessorCourseManager Math Section 1 : CourseOffering 1 : Add professor (Professor) T120B029

22 Collaboration diagram example : Registrar course form : CourseForm theManager : CurriculumManager aCourse : Course 4 : > 3 : add course 1 : set course info 2 : process T120B029

23 Complete example of collaboration diagrams POS Login

24 Comparing sequence & collaboration diagrams Layout of collaboration diagrams may show static connections of objects Sequence diagrams are best to see the flow of time –Sequence of messages more difficult to understand in collaboration diagrams Object organization with control flow is best seen through collaboration diagrams –Layout of collaboration diagrams may show static connections of objects Note: Complex control is difficult to express anyway!!! T120B029

25 Content of collaboration diagrams Objects –they exchange messages among each-other Messages –Synchronous: “call events,” denoted by the full arrow –Asynchronous: “signals,” denoted by a half arrow –There are also «create» and «destroy» messages Messages are numbered and can have loops  Almost same stuff as sequence diagrams!!!! T120B029

26 Collaboration diagrams can become VERY complex… T120B029

27 Proposed exercise Create a collaboration diagram equivalent to the sequence diagram for “Order Management” Use a collaboration diagram to model how you receive the request to develop a new piece of code -what is the difference with before? T120B029

28 Package Diagrams Remember: packages Package Diagrams Dependencies Ownership T120B029

29 How to break a system into smaller subsystems? Roman principle: Divide & conquer –Split up a large system into manageable parts Structured methods: functional decomposition OO: Group classes into higher level units Packages T120B029

30 Packages General purpose mechanism for organizing elements into groups Package forms a namespace –Names are unique within ONE package –UML assumes an anonymous root package Orders T120B029

31 Package diagrams Show packages Show dependencies between packages –Dependency exists between 2 elements if changes to the definition of one element may cause changes to the other –Import: source package has access to target Goal (& art) of large scale design: Minimize dependencies –Constraints effects of changes T120B029

32 Example package diagram OrdersCustomers Order Capture Application Mailing List Application Order Capture UI AWTMailing List UI dependencies > T120B029

33 Dependencies between packages Exist whenever there exist a dependency between classes of both packages –class A calls method of class B –class A has instance of B as part –method of A has parameter of type B Dependencies are not transitive (compilation dependencies are) OrdersCustomers Order Capture Application Mailing List Application Order Capture UI AWTMailing List UI T120B029

34 Owned elements Package may own other packages, classes, diagrams, … Hierarchical decomposition of the system T120B029

35 Owned packages OrdersCustomers Order Capture Application Mailing List Application Order Capture UI AWTMailing List UI Domain 2 interpretations –transparent: all contents of contained packages visible –opaque: only classes of the container are visible Add visibility stereotype (e.g. >) to make that clear T120B029

36 Owned classes Orders +Order -Item Orders +Order -Item or T120B029

37 How can the complexity of a package interface be restricted? Give all classes in the package only package visibility Define a public class that provides the public behavior of the package Delegate the public operations to the appropriate class inside the package Facades [Gamma et al. 1994] T120B029

38 Rules of thumb Try to avoid cycles in the dependency structure Too many dependencies: Try to refactor the system Use them when the system class diagram is not legible on a single letter size sheet of paper T120B029