+ All Categories
Home > Education > States and Activities

States and Activities

Date post: 15-Apr-2017
Category:
Upload: reem-alattas
View: 95 times
Download: 0 times
Share this document with a friend
40
Arab Open University 2 nd Semester, 2006-2007 M301 Unit 4. 5 States and Activities [email protected]
Transcript
Page 1: States and Activities

Arab Open University2nd Semester, 2006-2007

M301

Unit 4.5

States and Activities [email protected]

Page 2: States and Activities

Reem AlAttas © 2

Topic Road Map

Capturing more complex interactionsDesign issuesAn introduction to state machinesVariation of events and actionsPackages

Page 3: States and Activities

Conditional Message Sends in Sequence Diagrams

Page 4: States and Activities

Reem AlAttas © 4

If Statement

Guard

Page 5: States and Activities

Reem AlAttas © 5

If .. Else Statement

Mutually Exclusive

Branch

Page 6: States and Activities

Iterative Message Sends in Sequence Diagrams

Page 7: States and Activities

Reem AlAttas © 7

For Loop

Page 8: States and Activities

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

Reem AlAttas © 9

Defensive Programming

Pre-conditions should always be checked.

Disadvantage: conditions are repeatedly checked in different places.

Page 10: States and Activities

Reem AlAttas © 10

Strategies for Implementing Use Cases

One Central Class.Actor Class.Use Cases as Classes.

Page 11: States and Activities

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

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

Reem AlAttas © 13

Two Simple States for a Room Object

Initial State

Event

Transition

Page 14: States and Activities

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

Reem AlAttas © 15

Check In Sequence Diagram

Page 16: States and Activities

Reem AlAttas © 16

Adding Detail to a State Machine for a Room Object

EventAction

;aGuest.setRoom (self)

Page 17: States and Activities

Reem AlAttas © 17

A Simple State Machine for the Hotel Class

Self Transition

Page 18: States and Activities

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

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

Reem AlAttas © 20

… Entry and Exit Events

Page 21: States and Activities

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

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

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

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

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

Reem AlAttas © 26

Time Event

Page 27: States and Activities

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

Reem AlAttas © 28

A Simple Telephone State Chart Diagram

Page 29: States and Activities

Reem AlAttas © 29

A State Chart Diagram of the Composite State Active

Default Sub-state

Page 30: States and Activities

Reem AlAttas © 30

No Default Sub-state

Page 31: States and Activities

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

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

Reem AlAttas © 33

Why to Partition a S/W?

Manage size and complexity.Information hiding.Logical decomposition.

Page 34: States and Activities

Reem AlAttas © 34

Typical MIS

Page 35: States and Activities

Reem AlAttas © 35

Nested Packages

Page 36: States and Activities

Reem AlAttas © 36

Packages Present Architecture

Three-tiered architecture advantages: Parallel development. Reusability. Distribution.

Page 37: States and Activities

Reem AlAttas © 37

Subsystems

A subsystem has two sets of elements: Specification: Uses cases. Realization: Classes.

Page 38: States and Activities

Reem AlAttas © 38

… Subsystems

Or <<subsyste

m>>

Operations

Page 39: States and Activities

TMA4 – Q5

Page 40: States and Activities

Thank You!


Recommended