Object Modeling with UML: Behavioral Modeling

0 %
100 %
Information about Object Modeling with UML: Behavioral Modeling
Technology

Published on December 7, 2008

Author: adorepump

Source: slideshare.net

Object Modeling with UML: Behavioral Modeling Gunnar Övergaard, Bran Selic and Conrad Bock January 2000 © 1999 OMG and Tutorial Contributors: EDS, IBM, Enea Data, IntelliCorp, Klasse Objecten, ObjectTime Ltd., Rational Software, Unisys

Overview • Tutorial series • UML Quick Tour • Behavioral Modeling „ Part 1: Interactions and Collaborations „ Gunnar Övergaard, Rational Software „ Part 2: Statecharts „ Bran Selic, ObjecTime Limited „ Part 3: Activity Graphs „ Conrad Bock, IntelliCorp Behavioral Modeling with UML 2

Tutorial Series • Introduction to UML „ November 1999, Cambridge, US • Behavioral Modeling with UML „ January 2000, Mesa, Arizona, US • Advanced Modeling with UML „ March 2000, Denver, US • Metadata Integration with UML, XMI and MOF „ June 2000, Oslo, Norway Behavioral Modeling with UML 3

Tutorial Goals • What you will learn: „ what the UML is and what is it not „ UML’s basic constructs, rules and diagram techniques „ how the UML can model large, complex systems „ how the UML can specify systems in an implementation- independent manner „ how UML, XMI and MOF can facilitate metadata integration • What you will not learn: „ Object Modeling „ Development Methods or Processes „ Metamodeling Behavioral Modeling with UML 4

UML Quick Tour • The UML is a graphical language for „ specifying „ visualizing „ constructing „ documenting the artifacts of software systems • Added to the list of OMG adopted technologies in November 1997 as UML 1.1 • Most recent minor revision is UML 1.3 (November 1999) Behavioral Modeling with UML 5

UML Goals • Define an easy-to-learn but semantically rich visual modeling language • Unify the Booch, OMT, and Objectory modeling languages • Include ideas from other modeling languages • Incorporate industry best practices • Address contemporary software development issues „ scale, distribution, concurrency, executability, etc. • Provide flexibility for applying different processes • Enable model interchange and define repository interfaces Behavioral Modeling with UML 6

OMG UML Evolution 2001 (planned m ajor revision) <<docum ent>> UM L 2.0 << refine>> Other relevant standards TBA Q3 2000 <<docum ent>> (planned m inor revision) << inform alLiaison>> UM L 1.4 ISO Publicly << refine>> Available Specifications (PAS) <<docum ent>> Q3 1999 << form alLiaison> > UM L 1.3 << refine>> E ditorial revision <<docum ent>> with no significant Q2 1998 UM L 1.2 technical changes. << refine>> Q3 1997 U nification of m ajor (OM G Adopted <<docum ent>> m odeling languages, Technology) UM L 1.1 including B ooch, O M T and O bjectory Behavioral Modeling with UML 7

OMG UML 1.3 Specification • UML Summary • UML Semantics • UML Notation Guide • UML Standard Profiles „ Software Development Processes „ Business Modeling • UML CORBAfacility Interface Definition • UML XML Metadata Interchange DTD • Object Constraint Language Behavioral Modeling with UML 8

Tutorial Focus: the Language • language = syntax + semantics „ syntax = language elements (e.g. words) are assembled into expressions (e.g. phrases, clauses) „ semantics = the meanings of the syntactic expressions • UML Notation Guide – defines UML’s graphic syntax • UML Semantics – defines UML’s semantics Behavioral Modeling with UML 9

Unifying Concepts • classifier-instance dichotomy „ e.g. an object is an instance of a class OR a class is the classifier of an object • specification-realization dichotomy „ e.g. an interface is a specification of a class OR a class is a realization of an interface • analysis-time vs. design-time vs. run-time „ modeling phases (“process creep”) „ usage guidelines suggested, not enforced Behavioral Modeling with UML 10

Language Architecture • Metamodel architecture • Package structure Behavioral Modeling with UML 11

Metamodel Architecture M eta-M etam odel Lay er <<m e ta m ode l>> (M 3): S pec ifies m eta- MOF Me ta - m etac las s es for the m e ta m ode l UM L m etam odel M etam odel Lay er (M 2): S pec ifies m etac las s es <<m e ta m ode l>> for the UM L UML Me ta m ode l m etam odel, s uc h as Clas s M odel Lay er (M 1): S pec ifies c las s es for the UM L us er Use r Mode l m odels , s uc h as P as s enger, Tic k et, TravelA genc y Us er O bjec ts Lay er (M 0): :Foo :B ar :B az Us er objec ts that are ins tanc es of UM L us er m odel c las s es , s uc h as ins tanc es of P as s enger, Tic k et, TravelA genc y Behavioral Modeling with UML 12

Package Structure <<m etam odel>> UM L Behavioral M odel Elem ents M anagem ent dependency Foundation package Behavioral Modeling with UML 13

Package Structure Behavioral Elements Collaborations Use Cases State Machines Activity Graphs Model Management Common Behavior Foundation Behavioral Modeling with UML 14

Behavioral Modeling • Part 1: Interactions and Collaborations Gunnar Övergaard, Rational Software gunnaro@it.kth.se • Part 2: Statecharts • Part 3: Activity Diagrams Behavioral Modeling with UML 15

Interactions • What are interactions? • Core concepts • Diagram tour • When to model interactions • Modeling tips • Example: A Booking System Behavioral Modeling with UML 16

What are interactions? • Interaction: a collection of communications between instances, including all ways to affect instances, like operation invocation, as well as creation and destruction of instances • The communications are partially ordered (in time) Behavioral Modeling with UML 17

Interactions: Core Elements Construct Description Syntax Instance An entity with a unique identity and (object, to which a set of operations can be name data value, applied (signals be sent) and which attr values component has a state that stores the effects of instance the operations (the signals). etc.) Action A specification of an executable textual statement. A few different kinds of actions are predefined, e.g. CreateAction, CallAction, DestroyAction, and UninterpretedAction. Behavioral Modeling with UML 18

Interaction: Core Elements (cont’d) Construct Description Syntax Stimulus A communication between two instances. Operation A declaration of a service that can textual be requested from an instance to effect behavior. Signal A specification of an asynchronous «Signal» Name stimulus communicated between parameters instances. Behavioral Modeling with UML 19

Interaction: Core Relationships Construct Description Syntax Link A connection between instances. Attribute Link A named slot in an instance, which textual holds the value of an attribute. Behavioral Modeling with UML 20

Example: Instance triangle : Polygon underlined name triangle : Polygon center : Point = (2,2) triangle vertices : Point* = ((0,0), (4, 0), (2,4)) borderColor : Color = black fillColor : Color = white : Polygon attribute links Behavioral Modeling with UML 21

Example: Instances and Links : Family husband wife Joe : Person Jill : Person Behavioral Modeling with UML 22

Operation and Method Triangle foreach v in vertices do + move (in dist : Point) v.x := v.x + dist.x; + scale (in factor : Real) v.y := v.y + dist.y foreach v in vertices do v.x := factor * v.x; v.y := factor * v.y Behavioral Modeling with UML 23

Interaction Diagram Tour • Show interactions between instances in the model „ graph of instances (possibly including links) and stimuli „ existing instances „ creation and deletion of instances • Kinds „ sequence diagram (temporal focus) „ collaboration diagram (structural focus) Behavioral Modeling with UML 24

Interaction Diagrams Sequence Diagram Collaboration Diagram x y z 1.1: a 1.2: c a x y b 1.1.1: b c z Behavioral Modeling with UML 25

Sequence Diagram object symbol name : Class other lifeline stimulus name (…) activation new (…) : Class delete return create Behavioral Modeling with UML 26

Arrow Label predecessor guard-condition sequence-expression return-value := message-name argument-list move (5, 7) 3.7.4: move (5, 7) A3, B4 / [ x < 0 ] C3.1: res := getLocation (fig) 3.7 *[1..5]: move (5, 7) iteration predecessor guard sequence number return value message name argument list 3.7 [ z > 0 ]: move (5, 7) condition Behavioral Modeling with UML 27

Different Kinds of Arrows Procedure call or other kind of nested flow of control Flat flow of control Explicit asynchronous flow of control Return Behavioral Modeling with UML 28

Example: Different Arrows Nested Flow Flat Flow Asynchronous Flow teller : Order : Article caller exchange callee appl err handl alarm lift receiver getValue dial tone unknown price alarm dial digit dial digit getName ringing tone ringing signal lift receiver Behavioral Modeling with UML 29

Recursion, Condition, etc. calculator filter value [ x > 0] getValue () [ x < 0] transform () getValue () iterate () Behavioral Modeling with UML 30

Collaboration Diagram object symbol link symbol standard stereotype redisplay () window stimulus : Controller : Window standard standard window «parameter» 1: displayPositions (window) stereotype constraint 1.1.3.1 add (self) wire contents {new} 1.1 *[i := 1..n]: drawSegment (i) «local» line {new} wire :Wire : Line standard 1.1.2: create (r0, r1) «self» stereotype 1.1.3: display (window) standard 1.1.1a: r0 := position () 1.1.1b: r1 := position () constraint left : Bead right : Bead Behavioral Modeling with UML 31

When to Model Interactions • To specify how the instances are to interact with each other. • To identify the interfaces of the classifiers. • To distribute the requirements. Behavioral Modeling with UML 32

Interaction Modeling Tips • Set the context for the interaction. • Include only those features of the instances that are relevant. • Express the flow from left to right and from top to bottom. • Put active instances to the left/top and passive ones to the right/bottom. • Use sequence diagrams „ to show the explicit ordering between the stimuli „ when modeling real-time • Use collaboration diagrams „ when structure is important „ to concentrate on the effects on the instances Behavioral Modeling with UML 33

Example: A Booking System Behavioral Modeling with UML 34

Use Case Description: Change Flt Itinerary • Actors: traveler, client account db, airline reservation system • Preconditions: Traveler has logged in • Basic course: T Traveler selects ‘change flight itinerary’ option T System retrieves traveler’s account and flight itinerary from client account database T System asks traveler to select itinerary segment she wants to change; traveler selects itinerary segment. T System asks traveler for new departure and destination information; traveler provides information. T If flights are available then … T … T System displays transaction summary. • Alternative course: T If no flights are available then… Behavioral Modeling with UML 35

Sequence Diagram: Change Flight Itinerary Traveler : Booking System Client Account DBMS Airline Reservation System change flight itinerary get customer account get itinerary present itinerary select segment present detailed info update information available flight : : Behavioral Modeling with UML 36

Collaboration Diagram: Change Flt Itinerary 1: change flight itinerary 5: select segment 2: get customer account 3: get itinerary 7: update information : Booking System 4: present itinerary Traveler 6: present detailed info Client Account DBMS 8: available flight Airline Reservation System Behavioral Modeling with UML 37

Collaboration • What is a collaboration? • Core concepts • Diagram tour • When to model collaborations • Modeling tips • Example: A Booking System Behavioral Modeling with UML 38

What is a collaboration? • Collaboration: a collaboration defines the roles a set of instances play when performing a particular task, like an operation or a use case. • Interaction:an interaction specifies a communication pattern to be performed by instances playing the roles of a collaboration. Behavioral Modeling with UML 39

Collaborations: Core Elements Construct Description Syntax Collaboration A collaboration describes how an operation or a classifier, like a use case, is realized by a set of classifiers and associations used in a specific way. The collaboration defines a set of Name roles to be played by instances and links, as well as a set of interactions that define the communication patterns between the instances when they play the roles. Behavioral Modeling with UML 40

Collaborations: Core Elements (cont’d) Construct Description Syntax Classifier A classifier role is a specific role Role played by a participant in a / Name collaboration. It specifies a restricted view of a classifier, defined by what is required in the collaboration. Message A message specifies one label communication between instances. It is a part of the communication pattern given by an interaction. Behavioral Modeling with UML 41

Collaborations: Core Relationships Construct Description Syntax Association An association role is a specific Role usage of an association needed in a collaboration. Generalization A generalization is a taxonomic relationship between a more general element and a more specific element. The more specific element is fully consistent with the more general element. Behavioral Modeling with UML 42

Classifier-Instance-Role Trichotomy • An Instance is an entity id with behavior and a state, and has a unqiue identity. «originates from» • A Classifier is a description ClassName of an Instance. «conforms to» • A Classifier Role defines a / RoleName «view of» usage (an abstraction) of an Instance. Behavioral Modeling with UML 43

Classifier-Instance-Role Trichotomy (cont’d) Classifier ClassifierRole Attribute-1 Attribute-1 Attribute-2 Attribute-2 Attribute-3 «originates from» «conforms to» Operation-1 (…) Operation-1 (…) Operation-3 (…) Operation-2 (…) Operation-3 (…) Instance AttributeValue-1 AttributeValue-2 AttributeValue-3 The attribute values of an Instance corresponds to the attributes of its Classifier. All attributes required by the ClassifierRole have corresponding attribute values in the Instance. All operations defined in the Instance’s Classifier can be applied to the Instance. All operations required by the ClassifierRole are applicable to the Instance. Behavioral Modeling with UML 44

Different Ways to Name a Role / ClassifierRoleName : ClassifierName A role name is preceeded by a ‘/’ A classifier name is preceeded by a ‘:’ Example: / Parent : Person / Parent : Person instanceName / ClassifierRoleName : ClassifierName Example: : Person Charlie Charlie : Person Charlie / Parent Charlie / Parent : Person Behavioral Modeling with UML 45

Association and Association Role Class Association Class 0..5 Class-1 Class-2 {changeable} «view of» «view of» «view of» {frozen} 3..4 / Role-1 / Role-2 ClassifierRole AssociationRole ClassifierRole An Association Role specifies the required properties of a Link used in a Collaboration. The properties of an AssociationEnd may be restricted by a AssociationEndRole. Behavioral Modeling with UML 46

Example: A School / Teacher : Person / Student : Person 1 tutor student * position : Text program : Text faculty member * 1 lecturer participant * faculty 1 given course * taken course * : Faculty : Course Behavioral Modeling with UML 47

Role Model vs. Class Model The Classes give the complete description while the Roles specify one usage. Role Model Class Model Resulting multiplicity Extra attribute / Teacher : Person 1 * / Student : Person Person 0..1 Resulting multiplicity position : Text program : Text name : Text position : Text * * * program : Text * 1 0..1 1 * 1 * * * * : Faculty : Course Faculty Course Behavioral Modeling with UML 48

A Collaboration and Its Roles A Collaboration and how its roles are mapped onto CollaborationName a collection of Classifiers and Associations. roleName-1 roleName-2 roleName-3 Classifier-1 Classifier-2 Behavioral Modeling with UML 49

Patterns in UML Constraint that must Handler.reading = length (Subject.queue) be fulfilled in each instance Handler.range = {0..Subject.capacity} of this pattern. Observer Subject Handler CallQueue SlidingBarIcon queue : List of Call reading : Real source : Object color : Color waitAlarm : Alarm range : Interval capacity : Integer Behavioral Modeling with UML 50

Generalization Between Collaborations Subject Handler CallQueue Observer SlidingBarIcon Subject Manager ManagedQueue Supervisor Controller All roles defined in the parent are present in the child. Some of the parent’s roles may be overridden in the child. An overridden role is usually the parent of the new role. Behavioral Modeling with UML 51

Collaboration Diagram Tour • Show Classifier Roles and Association Roles, possibly together with extra constraining elements • Kinds „ Instance level – Instances and Links „ Specification level – Roles • Static Diagrams are used for showing Collaborations explicitly Behavioral Modeling with UML 52

Collaboration Diagram at Specification Level / Teacher : Person 1 tutor student * / Student : Person position : Text program : Text faculty member * * participant 1 lecturer faculty 1 given course * * taken course : Faculty : Course Behavioral Modeling with UML 53

Collaboration Diagram at Instance Level student tutor Alice / Student faculty member John / Teacher participant faculty tutor Bob / Student student : Faculty participant taken course taken course faculty lecturer given course Sara / Teacher English : Course faculty member Behavioral Modeling with UML 54

Collaborations including Interactions Sequence Diagram Collaboration Diagram x y z 1.1: a 1.2: c a x y b 1.1.1: b c z Behavioral Modeling with UML 55

Collaboration Diagram with Constraining Elements / Generator : Printer Device Constraining Element (A Generalization is not an AssociationRole ) : Laser Printer : Line Printer Behavioral Modeling with UML 56

Static Diagram With Collaboration and Classifiers Subject Handler CallQueue Observer SlidingBarIcon Subject Manager ManagedQueue Supervisor Controller Behavioral Modeling with UML 57

When to Model Collaborations • Use Collaborations as a tool to find the Classifiers. • Trace a Use Case / Operation onto Classifiers. • Map the specification of a Subsystem onto its realization (Tutorial 3). Behavioral Modeling with UML 58

Collaboration Modeling Tips • A collaboration should consist of both structure and behavior relevant for the task. • A role is an abstraction of an instance, it is not a class. • Look for „ initiators (external) „ handlers (active) „ managed entities (passive) Behavioral Modeling with UML 59

Example: A Booking System Behavioral Modeling with UML 60

Use Case Description: Change Flt Itinerary • Actors: traveler, client account db, airline reservation system • Preconditions: Traveler has logged in • Basic course: T Traveler selects ‘change flight itinerary’ option T System retrieves traveler’s account and flight itinerary from client account database T System asks traveler to select itinerary segment she wants to change; traveler selects itinerary segment. T System asks traveler for new departure and destination information; traveler provides information. T If flights are available then … T … T System displays transaction summary. • Alternative course: T If no flights are available then… Behavioral Modeling with UML 61

Booking System: Change Flt Itinerary Collaboration 4: get customer account 1: change flight itinerary 7: get itinerary : Traveler / Flight Itenerary Form / DBMS Protocol : Client Account DBMS 10: present 9: display 3: get customer account 2: create modifier 6: get itinerary / Flight Itinerary Modifier 5: create 8: create / Account / Itinerary / ARS Protocol : Airline Reservation System Behavioral Modeling with UML 62

Wrap Up: Interactions & Collaborations • Instances, Links and Stimuli are used for expressing the dynamics in a model. • Collaboration is a tool for „ identification of classifiers „ specification of the usage of instances „ expressing a mapping between different levels of abstraction • Different kinds of diagrams focus on time or on structure Behavioral Modeling with UML 63

Behavioral Modeling • Part 1: Interactions and Collaborations • Part 2: Statecharts Bran Selic, ObjecTime Limited bran@objectime.com • Part 3: Activity Diagrams Behavioral Modeling with UML 64

Overview • Basic State Machine Concepts • Statecharts and Objects • Advanced Modeling Concepts • Case Study • Wrap Up Behavioral Modeling with UML 65

Automata • A machine whose output behavior is not only a direct consequence of the current input, but of some past history of its inputs • Characterized by an internal state which represents this past experience ON ON ON ON OFF OFF Behavioral Modeling with UML 66

State Machine (Automaton) Diagram • Graphical rendering of automata behavior on Lamp On on off off Lamp Off Behavioral Modeling with UML 67

Outputs and Actions • As the automaton changes state it can generate outputs: on on Lamp Lamp On On print(”on”) on/print(”on”) on off off off off Lamp Lamp Off Off Mealy automaton Moore automaton Behavioral Modeling with UML 68

Extended State Machines • Addition of variables (“extended state”) on ctr :: Integer ctr Integer Lamp On on/ctr := ctr + 1 off off Lamp Off Behavioral Modeling with UML 69

A Bit of Theory • An extended (Mealy) state machine is defined by: „ a set of input signals (input alphabet) „ a set of output signals (output alphabet) „ a set of states „ a set of transitions „ triggering signal „ action „ a set of extended state variables „ an initial state designation „ a set of final states (if terminating automaton) Behavioral Modeling with UML 70

Basic UML Statechart Diagram “top” state State Initial Initial pseudostate pseudostate top Trigger Ready Transition stop /ctr := 0 Done Final Action Action state stop Behavioral Modeling with UML 71

What Kind of Behavior? • In general, state machines are suitable for describing event-driven, discrete behavior „ inappropriate for modeling continuous behavior threshold time Behavioral Modeling with UML 72

Event-Driven Behavior • Event = a type of observable occurrence „ interactions: „ synchronous object operation invocation (call event) „ asynchronous signal reception (signal event) „ occurrence of time instants (time event) „ interval expiry „ calendar/clock time „ change in value of some entity (change event) • Event Instance = an instance of an event (type) „ occurs at a particular time instant and has no duration Behavioral Modeling with UML 73

The Behavior of What? • In principle, anything that manifests event- driven behavior „ NB: there is no support currently in UML for modeling continuous behavior • In practice: „ the behavior of individual objects „ object interactions • The dynamic semantics of UML state machines are currently mainly specified for the case of active objects Behavioral Modeling with UML 74

• Basic State Machine Concepts • Statecharts and Objects • Advanced Modeling Concepts • Case Study • Wrap Up Behavioral Modeling with UML 75

Object Behavior - General Model • Simple server model: Initialize Initialize Handling depends on Handling depends on Object Object specific request type specific request type Wait for Wait for Request Request void:offHook (); Handle Handle {busy = true; obj.reqDialtone(); Request Request … }; Terminate Terminate Object Object Behavioral Modeling with UML 76

Object Behavior and State Machines • Direct mapping: on Initialize Object Lamp On Wait for Event on/print(”on”) Handle Event off off Lamp Off Terminate Object stop Behavioral Modeling with UML 77

Object and Threads • Passive objects: depend on external power (thread of execution) • Active objects: self-powered (own thread of execution) Initialize Initialize Initialize Initialize Object Object Object Object Wait for Wait for Wait for Wait for Request Request Request Request Handle Handle Handle Handle Request Request Request Request Terminate Terminate Terminate Terminate Object Object Object Object Behavioral Modeling with UML 78

Passive Objects: Dynamic Semantics Initialize Initialize Object Object Wait for Wait for Request Request Handle Handle Request Request Terminate Terminate Object Object • Encapsulation does not protect the object from concurrency conflicts! „ Explicit synchronization is still required Behavioral Modeling with UML 79

Active Objects and State Machines • Objects that encapsulate own thread of execution anActiveObject poll/defer #currentEvent : Event created + start ( ) start start/^master.ready() ready + poll ( ) + stop ( ) ready stop/ poll/^master.ack() Behavioral Modeling with UML 80

Active Objects: Dynamic Semantics ActiveObject: • Run-to-completion model: serialized event handling „ eliminates internal concurrency „ minimal context switching overhead Behavioral Modeling with UML 81

The Run-to-Completion Model • A high priority event for (another) active object will preempt an active object that is handling a low-priority event Active1 Active1 Active2 Active2 lo hi hi Behavioral Modeling with UML 82

• Basic State Machine Concepts • Statecharts and Objects • Advanced Modeling Concepts • Case Study • Wrap Up Behavioral Modeling with UML 83

State Entry and Exit Actions • A dynamic assertion mechanism LampOn e2 entry/lamp.on(); exit/lamp.off(); e1 Behavioral Modeling with UML 84

Order of Actions: Simple Case • Exit actions prefix transition actions • Entry action postfix transition actions LampOn LampOff off/printf(“to off”); entry/lamp.on(); entry/lamp.off(); exit/printf(“exiting”); exit/printf(“exiting”); Resulting action sequence: off/printf(“needless”); printf(“exiting”); printf(“exiting”); printf(“to off”); printf(“to printf(“exiting”); printf(“exiting”); lamp.off(); printf(“needless”); printf(“needless”); lamp.off(); Behavioral Modeling with UML 85

Internal Transitions • Self-transitions that bypass entry and exit actions Internal transition triggered by an “off” event LampOff entry/lamp.off(); exit/printf(“exiting”); off/null; Behavioral Modeling with UML 86

State (“Do”) Activities • Forks a concurrent thread that executes until: „ the action completes or „ the state is exited through an outgoing transition “do” activity Error entry/printf(“error!”) do/while (true) alarm.ring(); Behavioral Modeling with UML 87

Guards • Conditional execution of transitions „ guards (Boolean predicates) must be side-effect free bid [value < 100] /reject bid [value >= 200] /sell Selling Happy bid [(value >= 100) & (value < 200)] /sell Unhappy Behavioral Modeling with UML 88

Static Conditional Branching • Merely a graphical shortcut for convenient rendering of decision trees Selling Happy bid [value >= 200] /sell [value < 100] /reject [(value >= 100) & (value < 200)] /sell Unhappy Behavioral Modeling with UML 89

Dynamic Conditional Branching • Choice pseudostate: guards are evaluated at the instant when the decision point is reached Selling Happy bid /gain := calculatePotentialGain(value) [gain >= 200] /sell [gain < 100] /reject [(gain >= 100) & (gain < 200)] /sell Dynamic Dynamic choicepoint choicepoint Unhappy Behavioral Modeling with UML 90

Hierarchical State Machines • Graduated attack on complexity „ states decomposed into state machines LampOff LampOff flash/ LampFlashing entry/lamp.off() FlashOn FlashOn off/ entry/lamp.on() 1sec/ 1sec/ on/ on/ FlashOff FlashOff LampOn on/ LampOn entry/lamp.off() entry/lamp.on() Behavioral Modeling with UML 91

“Stub” Notation • Notational shortcut: no semantic significance LampOff LampOff flash/ LampFlashing entry/lamp.off() off/ FlashOn on/ on/ LampOn on/ FlashOff LampOn entry/lamp.on() Behavioral Modeling with UML 92

Group Transitions • Higher-level transitions Default transition to Default transition to the initial pseudostate the initial pseudostate LampOff LampOff flash/ LampFlashing entry/lamp.off() FlashOn FlashOn off/ entry/lamp.on() 1sec/ 1sec/ on/ FlashOff FlashOff LampOn on/ LampOn entry/lamp.off() entry/lamp.on() Group transition Group transition Behavioral Modeling with UML 93

Completion Transitions • Triggered by a completion event „ generated automatically when an immediately nested state machine terminates completion Committing transition (no trigger) Phase1 Phase1 CommitDone Phase2 Phase2 Behavioral Modeling with UML 94

Triggering Rules • Two or more transitions may have the same event trigger „ innermost transition takes precedence „ if no transition is triggered, event is discarded LampFlashing FlashOn FlashOn on/ off/ on/ FlashOff FlashOff Behavioral Modeling with UML 95

Order of Actions: Complex Case • Same approach as for the simple case S1 S2 exit/exS1 entry/enS2 initS2 S11 E/actE S21 exit/exS11 entry/enS21 Actions execution sequence: exS11 Ö exS1 Ö actE ÖenS2 Ö initS2 Ö enS21 Behavioral Modeling with UML 96

History • Return to a previously visited hierarchical state „ deep and shallow history options Diagnosing suspend/ Diagnostic1 Diagnostic1 Diagnostic2 Diagnostic2 Step11 Step11 Step21 Step21 resume/ Step12 Step12 Step22 Step22 H* H* Behavioral Modeling with UML 97

Orthogonality • Multiple simultaneous perspectives on the same entity age financialStatus Child Poor Adult Rich Retiree Behavioral Modeling with UML 98

Orthogonal Regions • Combine multiple simultaneous descriptions age financialStatus Child Poor Adult age financialStatus Child Rich Retiree Poor Adult Retiree Rich Behavioral Modeling with UML 99

Orthogonal Regions - Semantics • All mutually orthogonal regions detect the same events and respond to them “simultaneously” „ usually reduces to interleaving of some kind legalStatus financialStatus LawAbiding LawAbiding Poor Poor robBank/ robBank/ Outlaw Outlaw Rich Rich Behavioral Modeling with UML 100

Interactions Between Regions • Typically through shared variables or awareness of other regions’ state changes sane : Boolean sane : Boolean flying : Boolean flying : Boolean Catch22 Catch22 sanityStatus flightStatus Crazy Crazy Flying Flying entry/sane := false; entry/sane := false; entry/flying := true; entry/flying := true; (flying)/ (sane)/ request Grounding/ (~sane)/ Sane Sane Grounded Grounded entry/sane := true; entry/sane := true; entry/flying := false; entry/flying := false; Behavioral Modeling with UML 101

Transition Forks and Joins • For transitions into/out of orthogonal regions: age Child Child Adult Adult Retiree Retiree Staff Staff Manager Manager Member Member employee Behavioral Modeling with UML 102

Common Misuse of Orthogonality • Using regions to model independent objects Person1 Person2 Person1 Person2 Child Child Adult Adult Retiree Retiree Behavioral Modeling with UML 103

• Basic State Machine Concepts • Statecharts and Objects • Advanced Modeling Concepts • Case Study • Wrap Up Behavioral Modeling with UML 104

Case Study: Protocol Handler • A multi-line packet switch that uses the alternating-bit protocol as its link protocol AB protocol AB protocol AB End user sender line card 1 . unreliable AB End user receiver . telecom lines . AB sender AB SWITCH receiver End user line card N Behavioral Modeling with UML 105

Alternating Bit Protocol (1) • A simple one-way point-to-point packet protocol AB protocol AB protocol packetizer Sender Receiver unpacker data(1) pktA data(1) ack ackA ack data(2) pktB data(2) ack ackB ack …etc. Behavioral Modeling with UML 106

Alternating Bit Protocol (2) • State machine specification Sender SM Receiver SM AcceptPktA RcvdPktA ackB/^ack pktA/^data data/^pktA ack/^ackA timeout/^pktB timeout/^ackB WaitAckA WaitAckB WaitPktB WaitPktA timeout/^pktA timeout/^ackA ackA/^ack data/^pktB pktB/^data ack/^ackB AcceptPktB RcvdPktB Behavioral Modeling with UML 107

Additional Considerations • Support (control) infrastructure operator System AB interface operator receiver AB lines manager AB sender DB interface SWITCH DBase Behavioral Modeling with UML 108

Control The set of (additional) mechanisms and actions required to bring a system into the desired operational state and to maintain it in that state in the face of various planned and unplanned disruptions • For software systems this includes: „ system/component start-up and shut-down „ failure detection/reporting/recovery „ system administration, maintenance, and provisioning „ (on-line) software upgrade Behavioral Modeling with UML 109

Retrofitting Control Behavior Hardware JustCreated Audit Analysing Failure ReadyToGo GettingData AcceptPktA Failed WaitAckA WaitAckB AcceptPktB Behavioral Modeling with UML 110

The Control Automaton • In isolation, the same control behavior appears much simpler JustCreated GettingData Analysing

Add a comment

Related presentations

Related pages

Behavioral Modeling - Object Management Group

Behavioral Modeling Object Modeling with OMG UML Tutorial Series Gunnar Övergaard, Bran Selic, Conrad Bock and Morgan Björkander UML Revision Task Force
Read more

UML Web Resources - jeckle.de

Object Modeling in UML: Introduction to UML ... Object Modeling in UML: Behavioral Modeling (Lecture 2) Object Modeling in UML: Advanced Modeling (Lecture 3)
Read more

Unified Modeling Language - Object Management Group

We are celebrating 25 years of setting the standard! The Object Management Group (OMG) is an international, ... Threat Modeling; Read More: Object ...
Read more

Using UML Part Two – Behavioral Modeling Diagrams

Using UML – Behavioral Modeling Diagrams UML 2 Case Tool ... Using UML Part Two – Behavioral Modeling ... behavioral modeling diagrams. The Object ...
Read more

Object Modeling in UML-Introduction to UML2 - scribd.com

Object Modeling with UML: Behavioral Modeling ... Final Final Assembly Assembly Behavioral Modeling with UML 120 .Object/Data Flow • Each step ...
Read more

Behavioral Modeling with UML - scribd.com

Behavioral Modeling. Behavioral Modeling with UML 1 Behavioral Modeling Part 1: Interactions and Collaborations Part 2: Statecharts Part 3 ...
Read more

3. UML in behavioral modeling (4h) - ioz01.ioz.pwr.wroc.pl

© Dr. Witold Rekuć Business Object Modeling 56 3. UML in behavioral modeling (4h) Topics ... The behavioral modeling consists in modeling the course of ...
Read more

Object Modeling with OMG UML Tutorial Series

Advanced Modeling with UML 3 Tutorial Series! Lecture 1: Introduction to UML: Structural Modeling and Use Cases! Lecture 2: Behavioral Modeling with
Read more

Object Modeling with UML - researchgate.net

Object Modeling with UML: Behavioral Modeling Gunnar Övergaard, Bran Selic and Conrad Bock ... Behavioral Modeling with UML 7 OMG UML Evolution <>
Read more

Object Modeling with UML: Behavioral Modeling - HubSlide

Object Modeling with UML: Behavioral Modeling ...
Read more