Download presentation
Presentation is loading. Please wait.
Published byTodd Morris Sherman Modified over 8 years ago
1
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class diagrams Dynamic modeling – Interaction Diagrams Sequence diagrams Collaboration diagrams – State diagrams (activity diagrams) Describe the static structure of the system
2
2 Dynamic Modeling with UML Two UML diagrams types for dynamic modeling: – Interaction diagrams describe the dynamic behavior between objects – Statechart diagrams describe the dynamic behavior of a single object. Purpose: – Detect and supply operations for the object model.
3
3 UML Interaction Diagrams Two types of interaction diagrams: – Sequence Diagram: Describes the dynamic behavior of several objects over time Good for real-time specifications – Collaboration Diagram: Shows the temporal relationship among objects Position of objects is based on the position of the classes in the UML class diagram. Does not show time,
4
4 UML State Chart Diagram State Chart Diagram: – A state machine that describes the response of an object of a given class to the receipt of outside stimuli (Events). Activity Diagram: – A special type of state chart diagram, where all states are action states (Moore Automaton). Classes without interesting dynamic behavior are not modeled with state diagrams
5
State Chart Diagram vs Sequence Diagram State chart diagrams help to identify: – Changes to an individual object over time Sequence diagrams help to identify: – The temporal relationship of between objects over time – Sequence of operations as a response to one ore more events.
6
Dynamic Modeling We distinguish between two types of operations: – Activity: Operation that takes time to complete associated with states – Action: Instantaneous operation associated with events A state chart diagram relates events and states for one class An object model with several classes with interesting behavior has a set of state diagrams
7
UML State chart Diagram Notation State1 Event(attr) [condition]/action entry /action exit/action Note: – Events are italics – Conditions are enclosed with brackets: [] – Actions and activities are prefixed with a slash / do/Activity State2 Event with parameters attr Guard condition Action Name of State Actions and Activities in State
8
State An abstraction of the attributes of a class – State is the aggregation of several attributes of a class State has duration
9
Notations A state is drawn as a rounded box containing a name. The state name appears in bold face A transition is drawn as an arrow from the receiving state to the target state. Event names are written on the transition arrow, optionally followed by one or more attributes within parentheses. A condition is a Bollean function of object values. Conditions can be guards on transitions. A guarded transition fires only when the event occurs and the condition is true. Conditions are shown as expressions in square brackets following the event name and its parameter list.
10
Example ATM machine ATM machine object
11
Actions An action follows the event name and/or the condition by the slash (/) character. Events that cause an action without causing a state change are written inside the state box. Internal transition: When it occurs, neither the entry nor exit action is executed. Self-transition: when it occurs, entry and exit actions are executed. Events sent to other objects are shown in dashed lines.
12
Self-transition Internal transition
13
Example of Vending Machine Dispensing change do/Make change Dispensing do/Dispense item Idle [item empty] [select(item)] [change=0] [change>0] [change<0] coins_in(amount) / set balance cancel / refund coins Collecting Money coins_in(amount) / add to balance do/Test item and compute change vending machine object Calculating
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.