Modeling behavior with Sequence diagrams

50 %
50 %
Information about Modeling behavior with Sequence diagrams

Published on July 7, 2009

Author: erant



Modeling software interaction and behavior with sequence diagrams

Session 5:Modeling Behavior with UML Sequence Diagrams Analysis and Specification of Information Systems Spring 2008 Eran Toch

Outline Introduction Basic notation Alternating paths Modularity

Modeling Process Introduction | Basics | Alternations | Modularity

Why to Model Behavior? How do we use the SMS Server interface? What is the order of executing the operations? sendMessage, getStatus, Resend? getStatus, sendMessage, checkForMessages? When do we use resend? Introduction | Basics | Alternations | Modularity

Behavioral Modeling [if getStutus == err] Send message Resend Resend Get Status Adds a new msg Message queue Introduction | Basics | Alternations | Modularity

Outline Introduction Basic elements Alternating paths Modularity

Building a Sequence Diagrams Sequence diagrams capture the use-case behavior using the foundation of the classes. Use Case 1 Class C Class A Use Case 3 Use Case 2 Class D Class B Objects Sequence = + messages Introduction | Basics | Alternations | Modularity

Sequence Diagrams A simple sequence diagram: objects sd Product Buying Diagram Name p : Product : ShooppingCart customer display() message getPrice() activation (focus of control) addProduct (p) checkout () Lifeline Introduction | Basics | Alternations | Modularity

Object Control obj1 : Class1 Illustration obj2 : Class2 obj1 : Class1 user Object Creation operate() do (…) create (…) : Class3 Return Message foo() Messages to self Object Destruction Introduction | Basics | Alternations | Modularity

Illustration Corresponding Class Diagram Notice that a dependency exists whenever messages are passed between instances of the class Dependencies can be overridden by associations, aggregations etc. Introduction | Basics | Alternations | Modularity

Sequences and Use-Cases p : Product : ShooppingCart customer display() getPrice() addProduct (p) checkout () create (…) : Order Hidden part Visible part Introduction | Basics | Alternations | Modularity

Full Message Attributes sequence number [sequence-expression] [return-value :=] [message-name] [(argument-list)] C3.1: res := getLocation (fig) message name argument list return value Introduction | Basics | Alternations | Modularity

Different Kinds of Messages Synchronous Message asynchronousMessage Return Message Introduction | Basics | Alternations | Modularity

Synchronous & Asynchronous Messages Example Example Nested Flow Asynchronous Flow manager sensor eye sensor manager alarm check unknown unknown ring check operate log Price need to be finished, before teller can do another operation (getName) Ring is executed, while the control flow is returned to err handle and appl Introduction | Basics | Alternations | Modularity

Outline Introduction Basic elements Alternating paths Modularity

Flow Constructs If Loop Else Repeat Jump When we tell a scenario, which types of alternatives do we need? Introduction | Basics | Alternations | Modularity

Options Example msg : Message : Database Fragment opt Condition [msg.status=confirmed] archive(msg) Used for modeling simple optional blocks. Has one operand; no "else" guard. Do something... Introduction | Basics | Alternations | Modularity

Alternatives msg : Message : Database : Admin alt Alternative Fragment group [msg.status=confirmed] archive(msg) Condition [msg.status=error] notify(msg.getID()) [else] Execution regions. At most one will execute. wait() Else condition (optional) Introduction | Basics | Alternations | Modularity

Loops : OS : Folder : File loop [for each Folder] Loop Fragment Display() loop [for each File] Condition Display() Nested Loop Fragment Introduction | Basics | Alternations | Modularity

Breaks : Policy : User : User Manager isLooged = login(name,pass) If the condition is met, the break fragment is executed, and the reminder of the sequence is ignored break [¬isLooged] addBadLogin(name) Do something… Handy in model exception handling Do something … Introduction | Basics | Alternations | Modularity

Examples of Guards [for each Object] [5] [i=1..5] [status = okay] No guard means an infinite loop Introduction | Basics | Alternations | Modularity

Outline Introduction Basic elements Alternating paths Modularity

MODULARITY We need ways to create modular scenarios Introduction | Basics | Alternations | Modularity

Referencing a diagram : Policy : User : User Manager login(name,pass) ref Login Handling(user,pass) :bool Reference Gate Do something… Do something … Introduction | Basics | Alternations | Modularity

Referenced Diagram sd Login Handling Diagram name : User Manager : UserAccount loop Input message login(name,pass) [for each UserAccount] cName -= getUseNamer() cName -= getUseNamer() Output message opt [cName = name] isInSystem(true) true false Introduction | Basics | Alternations | Modularity

Summary Behavior ModelingSequence models interaction LanguageObjects + lifeline Messages AlternationsLoops Alternatives ModularityReferencing Introduction | Basics | Alternations | Modularity

Behavior Modeling




Add a comment

Related presentations

Related pages

Using UML Part Two – Behavioral Modeling Diagrams

... Behavioral Modeling Diagrams ... Using UML Part Two – Behavioral Modeling ... An activity is the specification of a parameterized sequence of behavior.
Read more

Modeling Behavior with UML Interactions and Statecharts

Modeling Behavior with UML Interactions and Statecharts Bruce Powel Douglass, Ph.D. ... • Sequence diagrams show the behavior of a group of instances over
Read more

UML 2 Sequence Diagrams: An Agile Introduction

UML sequence diagrams model the ... artifact for dynamic modeling, which focuses on identifying the behavior within your system ...
Read more

Modeling Behavior with Interaction Diagrams in a UML and ...

This paper discusses system modeling with UML behavior diagrams. We consider statecharts and both kinds of interaction diagrams, i.e., sequence and ...
Read more

UML tool: Use case diagrams - Behavior diagram examples

UML tool: Use case diagrams ... UML use case diagrams belong to the family of behavioral diagrams, ... Use case modeling is a very popular practice in UML.
Read more

Unified Modeling Language - Wikipedia, the free encyclopedia

The Unified Modeling Language ... This view includes sequence diagrams, ... Behavior diagrams emphasize what must happen in the system being modeled.
Read more

Structural Diagrams Behavioral Diagram

3 •Modeling Behavior •Sequence Diagrams Refining the Object Model •Typically, only very simplistic object models can be directly derived from use cases.
Read more

UML Behavioral Models [Enterprise Architect User Guide]

UML Behavioral Models; ... classifying its behavior according to transition triggers and constraining guards. ... Sequence Diagrams.
Read more

Dynamic Modeling - Chair for Applied Software Engineering

•Dynamic modeling •Sequence diagrams ... •Diagrams for dynamic modeling ... important dynamic behavior •Sequence diagrams: ...
Read more