states and activities
TRANSCRIPT
![Page 2: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/2.jpg)
Reem AlAttas © 2
Topic Road Map
Capturing more complex interactionsDesign issuesAn introduction to state machinesVariation of events and actionsPackages
![Page 3: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/3.jpg)
Conditional Message Sends in Sequence Diagrams
![Page 4: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/4.jpg)
Reem AlAttas © 4
If Statement
Guard
![Page 5: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/5.jpg)
Reem AlAttas © 5
If .. Else Statement
Mutually Exclusive
Branch
![Page 6: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/6.jpg)
Iterative Message Sends in Sequence Diagrams
![Page 7: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/7.jpg)
Reem AlAttas © 7
For Loop
![Page 8: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/8.jpg)
Reem AlAttas © 8
Topic Road Map
Capturing more complex interactions Design issuesAn introduction to state machinesVariation of events and actionsPackages
![Page 9: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/9.jpg)
Reem AlAttas © 9
Defensive Programming
Pre-conditions should always be checked.
Disadvantage: conditions are repeatedly checked in different places.
![Page 10: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/10.jpg)
Reem AlAttas © 10
Strategies for Implementing Use Cases
One Central Class.Actor Class.Use Cases as Classes.
![Page 11: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/11.jpg)
Reem AlAttas © 11
Topic Road Map
Capturing more complex interactionsDesign issues An introduction to state machinesVariation of events and actionsPackages
![Page 12: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/12.jpg)
Reem AlAttas © 12
The Essentials of State Machines
An event is an occurrence of a phenomenon at a certain moment in time and in a certain place.
Each state represents a particular period for which a given set of conditions applies.
Change takes place through transitions from one state to another. Transitions are said to be fired or triggered by events.
![Page 13: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/13.jpg)
Reem AlAttas © 13
Two Simple States for a Room Object
Initial State
Event
Transition
![Page 14: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/14.jpg)
Reem AlAttas © 14
… The Essentials of State Machines
An event when it occurs, has consequences. One consequence is a change of state. Other consequences are recorded in the action part of the label on the transition.
That is, instead of labeling a transition just with a simple name, we also record the actions (consequences) that result from the occurrence of the event.
![Page 15: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/15.jpg)
Reem AlAttas © 15
Check In Sequence Diagram
![Page 16: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/16.jpg)
Reem AlAttas © 16
Adding Detail to a State Machine for a Room Object
EventAction
;aGuest.setRoom (self)
![Page 17: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/17.jpg)
Reem AlAttas © 17
A Simple State Machine for the Hotel Class
Self Transition
![Page 18: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/18.jpg)
Reem AlAttas © 18
Self Transition
Originates in one state and returns to the same state.
If the same event is used on more than one transition, you must make sure that no more than one guard can evaluate to true. At most, you want just one transition to fire in such situations.
![Page 19: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/19.jpg)
Reem AlAttas © 19
Entry and Exit Events
An entry event happens every time an object enters a state.
An exit event happens every time an object leaves a state.
![Page 20: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/20.jpg)
Reem AlAttas © 20
… Entry and Exit Events
![Page 21: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/21.jpg)
Reem AlAttas © 21
Internal Transition
A special transition that does not involve a change of state.
In contrast to a self-transition, an internal transition does not cause the execution of any entry or exit actions.
![Page 22: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/22.jpg)
Reem AlAttas © 22
… Internal Transition
An internal transition may be used to handle an interrupt where you want some action to take place that does not affect the current state.
Internal transitions are written inside the state to which they refer.
![Page 23: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/23.jpg)
Reem AlAttas © 23
Final State
A state chart diagram shows no more than one initial state but there can be zero, one or more final states.
Initial and final states signify the creation and destruction of an object.
![Page 24: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/24.jpg)
Reem AlAttas © 24
Topic Road Map
Capturing more complex interactionsDesign issuesAn introduction to state machines Variation of events and actionsPackages
![Page 25: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/25.jpg)
Reem AlAttas © 25
Other Kinds of Events
External Vs. Internal Events.Synchronous Vs. Asynchronous Actions.UML defined 4 types of events:
Call Events. Signal Events. Change Events. Time Events.
![Page 26: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/26.jpg)
Reem AlAttas © 26
Time Event
![Page 27: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/27.jpg)
Reem AlAttas © 27
Looking Inside States
Simple State: a state that contains no substructure.
Composite State: a state that has other states nested within it, in order to represent some internal behavior.
![Page 28: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/28.jpg)
Reem AlAttas © 28
A Simple Telephone State Chart Diagram
![Page 29: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/29.jpg)
Reem AlAttas © 29
A State Chart Diagram of the Composite State Active
Default Sub-state
![Page 30: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/30.jpg)
Reem AlAttas © 30
No Default Sub-state
![Page 31: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/31.jpg)
Reem AlAttas © 31
Topic Road Map
Capturing more complex interactionsDesign issuesAn introduction to state machinesVariation of events and actions Packages
![Page 32: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/32.jpg)
Reem AlAttas © 32
Package
A general purpose mechanism for organizing model elements into groups.
Ex. A package allows you to gather together classes that share some common feature or behavior, such as order processing or stock control.
![Page 33: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/33.jpg)
Reem AlAttas © 33
Why to Partition a S/W?
Manage size and complexity.Information hiding.Logical decomposition.
![Page 34: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/34.jpg)
Reem AlAttas © 34
Typical MIS
![Page 35: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/35.jpg)
Reem AlAttas © 35
Nested Packages
![Page 36: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/36.jpg)
Reem AlAttas © 36
Packages Present Architecture
Three-tiered architecture advantages: Parallel development. Reusability. Distribution.
![Page 37: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/37.jpg)
Reem AlAttas © 37
Subsystems
A subsystem has two sets of elements: Specification: Uses cases. Realization: Classes.
![Page 38: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/38.jpg)
Reem AlAttas © 38
… Subsystems
Or <<subsyste
m>>
Operations
![Page 39: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/39.jpg)
TMA4 – Q5
![Page 40: States and Activities](https://reader035.vdocuments.us/reader035/viewer/2022081517/58f1768a1a28ab77318b4591/html5/thumbnails/40.jpg)
Thank You!