ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.

Slides:



Advertisements
Similar presentations
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Advertisements

UML State chart/machine diagram State machine diagram is a behavior diagram which shows discrete behavior of a part of designed system through finite state.
ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
System Sequence Diagrams
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Introduction to Software Engineering 7. Modeling Behaviour.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Object-Oriented Analysis and Design
10. Petri Nets Prof. O. Nierstrasz. Roadmap  Definition: —places, transitions, inputs, outputs —firing enabled transitions  Modelling: —concurrency.
Object-Oriented Reengineering Patterns and Techniques Prof. O. Nierstrasz Prof. S. Ducasse T.
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
CP — Concurrent Programming 12. Petri Nets Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
© 2005 Prentice Hall4-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
N. XXX Prof. O. Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.
ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
© Copyright Eliyahu Brutman Programming Techniques Course.
State Change Modelling. Aim: To introduce the concept and techniques for describing the changes in state that may occur to an object in its lifetime.
Sharif University of Technology1 Design and Use-case Realization Software Engineering Laboratory Fall 2006.
OORPT Object-Oriented Reengineering Patterns and Techniques X. CHAPTER Prof. O. Nierstrasz.
CP — Concurrent Programming X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
12. eToys. © O. Nierstrasz PS — eToys 12.2 Denotational Semantics Overview:  … References:  …
SE-565 Software System Requirements More UML Diagrams.
Unified Modeling Language
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
Lecture 6 Unified Modeling Language (UML)
Class, Sequence and UML Model.  Has actors and use cases.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
Dynamic Modeling Chapter 11 Part of Analysis Modeling Designing Concurrent, Distributed, and Real-Time Applications with UML Hassan Gomaa (2001)
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
UML What Is the UML? The Unified Modeling Language (UML) is the successor to the wave of object- oriented analysis and design (OOA&D) methods.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Unified Modeling Language* Keng Siau University of Nebraska-Lincoln *Adapted from “Software Architecture and the UML” by Grady Booch.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
An Introduction to the Unified Modeling Language
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Interaction Diagrams Interaction Diagrams allow the designer to show how groups of objects collaborate in some behavior. –Interaction Diagrams will show.
COMP-350 Object-Oriented Analysis and Design Drawing System Sequence Diagrams Reference: Larman, Chapter 9.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
UNIFIED MODELING LANGUAGE(UML) BY Touseef Tahir Lecturer CS COMSATS Institute of Information Technology, Lahore.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
(14-2) UML Instructor - Andrew O’Fallon CptS 122 (December 2, 2015) Washington State University.
Systems Analysis and Design in a Changing World, Fourth Edition
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Chapter 3: Introducing the UML
CSCI 3428: Software Engineering Tami Meredith UML Unified Modeling Language.
21/1/ Analysis - Model of real-world situation - What ? System Design - Overall architecture (sub-systems) Object Design - Refinement of Design.
CS 501: Software Engineering Fall 1999 Lecture 15 Object-Oriented Design I.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 14 Slide 1 Object-Oriented Design.
Embedded Systems Software Engineering
Appendix 3 Object-Oriented Analysis and Design
Evolution of UML.
Unified Modeling Language
Business System Development
Software Engineering Chapter 5 (Part 3) System Modeling Dr.Doaa Sami.
Princess Nourah bint Abdulrahman University
Unified Modeling Language
Week 12: Activity & Sequence Diagrams
CIS 375 Bruce R. Maxim UM-Dearborn
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.2 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.3 Source  The Unified Modeling Language Reference Manual, James Rumbaugh, Ivar Jacobson and Grady Booch, Addison Wesley, 1999.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.4 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.5 Use Case Diagrams A use case is a generic description of an entire transaction involving several actors. A use case diagram presents a set of use cases (ellipses) and the external actors that interact with the system. Dependencies and associations between use cases may be indicated.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.6 Using Use Case Diagrams  “A use case is a snapshot of one aspect of your system. The sum of all use cases is the external picture of your system …” —UML Distilled  “As use cases appear, assess their impact on the domain model.” —Use cases can drive domain modeling by highlighting the important concepts.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.7 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.8 Scenarios A scenario is an instance of a use case showing a typical example of its execution. Scenarios can be presented in UML using either sequence diagrams or collaboration diagrams. Note that a scenario only describes an example of a use case, so conditionality cannot be expressed!

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.9 Sequence Diagrams A sequence diagram depicts a scenario by showing the interactions among a set of objects in temporal order. Objects (not classes!) are shown as vertical bars. Events or message dispatches are shown as horizontal (or slanted) arrows from the sender to the receiver.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.10 Activations Avoid returns in sequence diagrams unless they add clarity.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.11 Asynchrony and Constraints

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.12 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.13 Collaboration Diagrams Collaboration diagrams (called Communication diagrams in UML 2.0) depict scenarios as flows of messages between objects:

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.14 Message Labels Messages from one object to another are labelled with text strings showing the direction of message flow and information indicating the message sequence. 1. Prior messages from other threads (e.g. “[A1.3, B6.7.1]”) – only needed with concurrent flow of control 2. Dot-separated list of sequencing elements – sequencing integer (e.g., “3.1.2” is invoked by “3.1” and follows “3.1.1”) – letter indicating concurrent threads (e.g., “1.2a” and “1.2b”) – iteration indicator (e.g., “1.1*[i=1..n]”) – conditional indicator (e.g., “2.3 [#items = 0]”) 3. Return value binding (e.g., “status :=”) 4. Message name – event or operation name 5. Argument list

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.15 Nested Message Flows

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.16 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.17 Statechart Diagrams

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.18 Statechart Diagram Notation A Statechart Diagram describes the temporal evolution of an object of a given class in response to interactions with other objects inside or outside the system. An event is a one-way (asynchronous) communication from one object to another: —atomic (non-interruptible) —includes events from hardware and real-world objects e.g., message receipt, input event, elapsed time,... —notation: eventName(parameter: type,...) —may cause object to make a transition between states

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.19 Statechart Diagram Notation... A state is a period of time during which an object is waiting for an event to occur: —depicted as rounded box with (up to) three sections: – name — optional – state variables — name: type = value (valid only for that state) – triggered operations — internal transitions and ongoing operations —may be nested

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.20 State Box with Regions The entry event occurs whenever a transition is made into this state, and the exit operation is triggered when a transition is made out of this state. The help and character events cause internal transitions with no change of state, so the entry and exit operations are not performed.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.21 Transitions A transition is an response to an external event received by an object in a given state —May invoke an operation, and cause the object to change state —May send an event to an external object —Transition syntax (each part is optional): event(arguments) [condition] / ^target.sendEvent operation(arguments) —External transitions label arcs between states —Internal transitions are part of the triggered operations of a state

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.22 Operations and Activities An operation is an atomic action invoked by a transition —Entry and exit operations can be associated with states An activity is an ongoing operation that takes place while object is in a given state —Modelled as “internal transitions” labelled with the pseudo-event do

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.23 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.24 Nested Statecharts

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.25 Composite States Composite states may depicted either as high-level or low-level views. “Stubbed transitions” indicate the presence of internal states: Initial and terminal substates are shown as black spots and “bulls-eyes”

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.26 Sending Events between Objects

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.27 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.28 Concurrent Substates

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.29 Branching and Merging Entering concurrent states: Entering a state with concurrent substates means that each of the substates is entered concurrently (one logical thread per substate). Leaving concurrent states: A labelled transition out of any of the substates terminates all of the substates. An unlabelled transition out of the overall state waits for all substates to terminate.

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.31 Roadmap  Use Case Diagrams  Sequence Diagrams  Collaboration (Communication) Diagrams  Statechart Diagrams —Nested statecharts —Concurrent substates  Using UML

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.32 Perspectives Three perspectives in drawing UML diagrams: 1. Conceptual —Represent domain concepts – Ignore software issues 2. Specification —Focus on visible interfaces and behaviour – Ignore internal implementation 3. Implementation —Document implementation choices – Most common, but least useful perspective(!) —UML Distilled

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.33 Using the Notations The diagrams introduced here complement class and object diagrams. During Analysis: —Use case, sequence and collaboration diagrams document use cases and their scenarios during requirements specification During Design: —Sequence and collaboration diagrams can be used to document implementation scenarios or refine use case scenarios —State diagrams document internal behaviour of classes and must be validated against the specified use cases

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.34 What you should know!  What is the purpose of a use case diagram?  Why do scenarios depict objects but not classes?  How can timing constraints be expressed in scenarios?  How do you specify and interpret message labels in a scenario?  How do you use nested state diagrams to model object behaviour?  What is the difference between “external” and “internal” transitions?  How can you model interaction between state diagrams for several classes?

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.35 Can you answer the following questions?  Can a sequence diagram always be translated to an collaboration diagram?  Or vice versa?  Why are arrows depicted with the message labels rather than with links?  When should you use concurrent substates?

© Oscar Nierstrasz ESE — Modeling Behaviour ESE 7.36 License > Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. Attribution-ShareAlike 2.5 You are free: to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above.