Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unified Modeling Language Unit 4. Dynamic Modeling.

Similar presentations


Presentation on theme: "Unified Modeling Language Unit 4. Dynamic Modeling."— Presentation transcript:

1 Unified Modeling Language Unit 4. Dynamic Modeling

2 Objectives Actors & Uses Cases Sequence Diagram Dynamic Context Diagram State Diagram Activity Diagram

3 How to make a better dynamic model ? Phases 1. Identify all system actors 2. Draw the static context diagram 3. Make the uses cases diagram 4. Describe all the uses cases using an activity diagram and a sequence diagram 5. Make state machine diagram 6. Final : dynamic context diagram

4 Example : A Public Phone Call minimal price : 0.1 RON The user have 2 minutes to compose the destination phone number after he finished to introduce his money The destination phone number may be available or no The public phone consume the money for each minute in which the user speak The user can introduce money all the times When the user finish to speak, the public phone

5 1.Actors & Uses Cases

6 2.Sequence Diagram

7 3. Dynamic Context Diagram The studied system it’s represent by an object situated on the diagram center The central object is surrounded by all the actors Between each actor and the system is a linking graphical represented with a line Over each linking all in-messages and out- messages between the actor and the system are wrote,without numerotation

8 Example Public Phone unhookReceipter introMoney(p) composeNumber(num) hookReceipter tonality Tonality(free) beginComunication TU linkNumber(num) finishComunication

9 Dynamic Context Diagram Caracteristics This diagram is used as a linking between the sequnce diagram and the state machine diagram To make this diagram is very useful to create at first for each actor two messages categories : a category with all sends messages and other with all receives messages

10 4.State Machine Diagram Generalities How to find special classes ? Fundamental concepts State Machine Organisation When to use state machine diagram ? Dynamic Context Diagram & State Machine Diagram

11 4.1 Generalities State Machine are a familiar technique to describe the behavior of a system A state machine diagram for a class show the lifetime behavior of a single object The static context diagram it isn’t necessary for all classes of system class diagram First we must found the classes with a complex and dynamic behavior Only for these classes the state machine diagram is necessary

12 Generalities … Each state machine diagram only for one class No state machine diagram if the class haven’t differents states It is not advised to make a state machine diagram as a general view for the sistem

13 4.2 How to find the special classes ? If the objects which instanced a class have different reaction at the same event If each reaction type it’s a particullar state If the class must organize diferent operation in a fixed order => For this class must describe the state machine diagram

14 4.3 Fundamental concepts State Action & Activity Event Transition

15 4.3.1 State (Definition) Values ensemble which implies the same reponse for a specific event Life object period in which the object - It satisfy certains conditions - Wait an event - Make an activity Special states

16 4.3.2 Action & Activity Start state action initialization procedures (setup,…) State activity continuous realized (display something …) Finish state activity cleaning, exception treatment ex State X Enter / ActionName Do / ActionName Exit / ActionName

17 4.3.3 Event All extern influence it’s represented by an event  Time point  Asynchrony  Atomic  Uni-directional

18 Events may be : Operation call  Signal eventName(param,param,…)  Parameter nameParam : type Signal reception True condition  when(boolean expresion) Time passage  After ( 5 seconds)  After (10 seconds after exit from the first state)

19 Events classification Temporal Event ex after(time) Intern Event ex when(condition-with-obj-caractersitics) Reception Message Event

20 Event description A class description With generalisation With stereotypes > Event > User Event > Mouse Click > Key Pressesd

21 4.3.4 Transition For connecting only 2 state machine A transition indicates a movement from one state to another state One event can’t activate only one transition 1 Event 1 Transition

22 Example

23 Transition Syntax Event (args) [guard] / Action (args) -Boolean expression -It’s evaluated at event entrance -Must be true -Function - event parameters - object attributes values - object method or a method of an accessible object

24 Example 1

25 Transition Syntax … All syntax parts are optional The event can trigger a potential change of state The guard if it is present is a boolean condition that must be true for the transition to be taken The activity it’s some behavior that’s executed during the transition A missing guard indicates that you always take the transition if the event occurs A missing activity indicates that you do anything during the transition A missing event signature it’s rare and you indicated that you must take the transition immediately

26 Example 2

27 4.4 State machine organization Sequential Substate Concurent Substate

28 Superstate If you find that several state share common transition and internal activities it’s useful a superstate

29 Example of sequential decomposition & Superstate Washing Machine Description

30 Example of concurrent decomposition

31 Concurrent Orthogonal State H=history pseudostate.This indicates that when the clock is switched on, the Radio/CD choice goes back to the state the clock was in whet it was turnned off.

32 Synchronisation

33 4.5 When to Use State Machine Diagram State diagram are good to use at describing behavior of an object across several uses cases State diagram are not very good to describe behavior that involves a number of objects collaborating Use state diagram only for classes that exhibit an intersting behavior User Interfaces and controllers have a kind of behavior that it’s useful to depict with a state diagram

34 4.6 Dynamic Context Diagram and State Machine Diagram The received messages by an actor become event which triger a transition The sended messages by an actor become action for transition

35 Our Example Review Public Phone tonality Tonality(free) beginComunication TU linkNumber(num) finishComunication unhookReceipter introMoney(p) composeNumber(num) hookReceipter

36 Version 1.0

37 Version 1.1

38 Version 2.0

39 Version 2.1

40 Version 2.2 UT [insuficient founds] /taxer introMoney(p) /CreditIcrement(p) Give money

41 Version 2.3 UT [insuficient founds] /taxer introMoney(p) /CreditIcrement(p) Give money

42 Version 3.0 FiNAL Give money UT [insuficient founds] /taxer introMoney(p)[p OK] /CreditIcrement(p)

43 5.Activity Diagram An activity graph is a special form of state machine intended to model coputational workflow An activity graph contains activity states An activity state represents the execution of a statement in a procedure or the performance of an activity in a workflow An activity diagram is a notation for an activity diagram

44 5.1Concepts Action - Atomik - It can be interrupt Activity = Actions Group - May be decomposed in more actions - May be interrupted Transition - if an activity is finish the workflow going on the next activity => transition - transitions are also used for exceptions traitement

45 5.2 Notation

46 5.3 Example

47 Thank You !


Download ppt "Unified Modeling Language Unit 4. Dynamic Modeling."

Similar presentations


Ads by Google