Presentation is loading. Please wait.

Presentation is loading. Please wait.

Www.techstudent.co.cc State Modeling. www.techstudent.co.cc Events An event is an occurrence at a point in time, such as user depresses left button or.

Similar presentations


Presentation on theme: "Www.techstudent.co.cc State Modeling. www.techstudent.co.cc Events An event is an occurrence at a point in time, such as user depresses left button or."— Presentation transcript:

1 www.techstudent.co.cc State Modeling

2 www.techstudent.co.cc Events An event is an occurrence at a point in time, such as user depresses left button or flight 123 departs from Chicago. By definition, an event happens instantaneously with regard to the time scale of an application. One event may logically precede or follow another or two events may be unrelated. An event is an occurrence at a point in time, such as user depresses left button or flight 123 departs from Chicago. By definition, an event happens instantaneously with regard to the time scale of an application. One event may logically precede or follow another or two events may be unrelated. A signal is an explicit one-way transmission of information from one object to another. It is different from a subroutine call that returns a value. A signal event is the event of sending or receiving a signal. A change event is an event that is caused by satisfaction of boolean expression. A signal is an explicit one-way transmission of information from one object to another. It is different from a subroutine call that returns a value. A signal event is the event of sending or receiving a signal. A change event is an event that is caused by satisfaction of boolean expression.

3 www.techstudent.co.cc States A state is an abstraction of the values and links of an object. Sets of values and links are grouped together into a state according to the gross behavior of objects. A state is an abstraction of the values and links of an object. Sets of values and links are grouped together into a state according to the gross behavior of objects. Events and States Events and States

4 www.techstudent.co.cc Transitions and Conditions A transition is an instantaneous change from one state to another. The transition is said to fire the change from the source state to the target state. The origin and target of a transition usually are different states, but may be same. A transition fires when its event occurs. The choice of next state depends on both the original state and the event received. An event may cause multiple objects to transitions. A transition is an instantaneous change from one state to another. The transition is said to fire the change from the source state to the target state. The origin and target of a transition usually are different states, but may be same. A transition fires when its event occurs. The choice of next state depends on both the original state and the event received. An event may cause multiple objects to transitions. A guard condition is a boolean expression that must be true in order for a transition to occur. A guard condition fire when its event occurs, but only if the guard condition is true. “when you wake up in the morning (event), if the temperature is below freezing (condition), then put on your gloves ( next state) A guard condition is a boolean expression that must be true in order for a transition to occur. A guard condition fire when its event occurs, but only if the guard condition is true. “when you wake up in the morning (event), if the temperature is below freezing (condition), then put on your gloves ( next state)

5 www.techstudent.co.cc State Diagrams A State diagram is a graph whose nodes are states and whose directed arcs are transitions between states. A state diagram specifies the state sequence caused by event sequences. State names must be unique within the scope of a state diagram. All objects in a class execute the state diagram for that class, which models their behavior. The state diagram consists of multiple diagrams, one state diagram for each class with important temporal behavior. A state diagram must match their interface-events and guard conditions. A State diagram is a graph whose nodes are states and whose directed arcs are transitions between states. A state diagram specifies the state sequence caused by event sequences. State names must be unique within the scope of a state diagram. All objects in a class execute the state diagram for that class, which models their behavior. The state diagram consists of multiple diagrams, one state diagram for each class with important temporal behavior. A state diagram must match their interface-events and guard conditions.

6 www.techstudent.co.cc State Diagrams State diagrams are used to describe the behavior of a system. State diagrams describe all of the possible states of an object as events occur. State diagrams are used to describe the behavior of a system. State diagrams describe all of the possible states of an object as events occur. Each diagram usually represents objects of a single class and track the different states of its objects through the system Each diagram usually represents objects of a single class and track the different states of its objects through the system State diagram for a class shows the states that objects of that class may assume and the transitions the objects may make from state. State diagram for a class shows the states that objects of that class may assume and the transitions the objects may make from state.

7 www.techstudent.co.cc Basic State Diagrams State diagrams have very few elements. The basic elements are rounded boxes representing the state of the object and arrows indicting the transition to the next state. The activity section of the state symbol depicts what activities the object will be doing while it is in that state State diagrams have very few elements. The basic elements are rounded boxes representing the state of the object and arrows indicting the transition to the next state. The activity section of the state symbol depicts what activities the object will be doing while it is in that state

8 www.techstudent.co.cc Basic State Diagrams All state diagrams being with an initial state of the object. This is the state of the object when it is created. After the initial state the object begins changing states. Conditions based on the activities can determine what the next state the object transitions to. All state diagrams being with an initial state of the object. This is the state of the object when it is created. After the initial state the object begins changing states. Conditions based on the activities can determine what the next state the object transitions to.

9 www.techstudent.co.cc Basic State Diagrams An Example An Example

10 www.techstudent.co.cc State Diagram for a telephone line

11 www.techstudent.co.cc Nested State Diagrams State diagrams can also show a super-state for the object. A super-state is used when many transitions lead to the a certain state. Instead of showing all of the transitions from each state to the redundant state a super-state can be used to show that all of the states inside of the super- state can transition to the redundant state. This helps make the state diagram easier to read State diagrams can also show a super-state for the object. A super-state is used when many transitions lead to the a certain state. Instead of showing all of the transitions from each state to the redundant state a super-state can be used to show that all of the states inside of the super- state can transition to the redundant state. This helps make the state diagram easier to read

12 www.techstudent.co.cc Nested State Diagrams Both the Checking and Dispatching states can transition into the Canceled state, so a transition is shown from a super-state named Active to the state Cancel. By contrast, the state Dispatching can only transition to the Delivered state, so we show an arrow only from the Dispatching state to the Delivered state Both the Checking and Dispatching states can transition into the Canceled state, so a transition is shown from a super-state named Active to the state Cancel. By contrast, the state Dispatching can only transition to the Delivered state, so we show an arrow only from the Dispatching state to the Delivered state

13 www.techstudent.co.cc Nested State Diagrams A State of Washing Machine A State of Washing Machine

14 www.techstudent.co.cc Concurrent States and Synchronization This covers the concurrent states that an object may have and goes deeper into the topic of nested states. Activity diagrams describe the workflow behavior of a system. This covers the concurrent states that an object may have and goes deeper into the topic of nested states. Activity diagrams describe the workflow behavior of a system. Activity diagrams are similar to state diagrams, because activities are the state of doing something. The diagrams describe the state of activities by showing the sequence of activities performed. Activity diagrams can show activities that are conditional or parallel. Activity diagrams are similar to state diagrams, because activities are the state of doing something. The diagrams describe the state of activities by showing the sequence of activities performed. Activity diagrams can show activities that are conditional or parallel. Activity diagrams should be used in conjunction with other modeling techniques such as interaction diagrams and state diagrams. Activity diagrams should be used in conjunction with other modeling techniques such as interaction diagrams and state diagrams.

15 www.techstudent.co.cc Concurrent States and Synchronization This covers the concurrent states that an object may have and goes deeper into the topic of nested states. Activity diagrams describe the workflow behavior of a system. This covers the concurrent states that an object may have and goes deeper into the topic of nested states. Activity diagrams describe the workflow behavior of a system. 1

16 www.techstudent.co.cc Concurrent States and Synchronization

17 www.techstudent.co.cc Concurrent States and Synchronization The diagram shows the flow of actions in the system's workflow. Once the order is received the activities split into two parallel sets of activities. One side fills and sends the order while the other handles the billing. On the Fill Order side, the method of delivery is decided conditionally. Depending on the condition either the Overnight Delivery activity or the Regular Delivery activity is performed. Finally the parallel activities combine to close the order The diagram shows the flow of actions in the system's workflow. Once the order is received the activities split into two parallel sets of activities. One side fills and sends the order while the other handles the billing. On the Fill Order side, the method of delivery is decided conditionally. Depending on the condition either the Overnight Delivery activity or the Regular Delivery activity is performed. Finally the parallel activities combine to close the order

18 www.techstudent.co.cc Concurrent States and Synchronization Example: Washing Machine Example: Washing Machine

19 www.techstudent.co.cc Concurrency The state model implicitly supports concurrency among objects, In general, objects are autonomous entities that can act and change state independent of one another. Objects need not be completely independent and may be subject to shared constraints that cause some correspondence among their state changes. The state model implicitly supports concurrency among objects, In general, objects are autonomous entities that can act and change state independent of one another. Objects need not be completely independent and may be subject to shared constraints that cause some correspondence among their state changes. Aggregation concurrency: the aggregate state corresponds to the combined states of all parts. Aggregation is the “and-relationship”. The aggregate state is one state from the first diagram and the state from the second diagram and a state from each other diagram. Aggregation concurrency: the aggregate state corresponds to the combined states of all parts. Aggregation is the “and-relationship”. The aggregate state is one state from the first diagram and the state from the second diagram and a state from each other diagram.

20 www.techstudent.co.cc The state of a CAR as an aggregation of part states The state of a CAR as an aggregation of part states

21 www.techstudent.co.cc You can partition some objects into subsets of attributes or links each of which has its own sub diagram You can partition some objects into subsets of attributes or links each of which has its own sub diagram

22 www.techstudent.co.cc Sometimes one object must perform two (or more) activities concurrently. The objects does not synchronize the internal steps of the activities but must complete both activities before it can progress to its next state. Sometimes one object must perform two (or more) activities concurrently. The objects does not synchronize the internal steps of the activities but must complete both activities before it can progress to its next state.

23 www.techstudent.co.cc Interaction Modeling Interaction model is the third leg of the modeling tripod and describes interactions with in a system. The class model describes the objects in the system and their relationships. The state model describes the life cycles of the objects. Interaction model is the third leg of the modeling tripod and describes interactions with in a system. The class model describes the objects in the system and their relationships. The state model describes the life cycles of the objects. The interaction model describes how the objects interact to produce useful results. Interaction can be modeled at different levels of abstraction. At high level use cases describes how a system interacts with outside actors. Each use case represents a piece of functionality that a system provides to its users. Use cases are helpful for capturing informal requirements. The interaction model describes how the objects interact to produce useful results. Interaction can be modeled at different levels of abstraction. At high level use cases describes how a system interacts with outside actors. Each use case represents a piece of functionality that a system provides to its users. Use cases are helpful for capturing informal requirements.

24 www.techstudent.co.cc Interaction Modeling Sequence diagram provide more detail and show the messages exchanged among a set of objects over time. Messages include both asynchronous signals and procedure calls. Sequence diagrams are good for showing the behavior sequences seen by users of a system Sequence diagram provide more detail and show the messages exchanged among a set of objects over time. Messages include both asynchronous signals and procedure calls. Sequence diagrams are good for showing the behavior sequences seen by users of a system Activity diagrams provide further detail and show the flow of control among the steps of computation. Activity diagrams can show data flows as well as control flows. Activity diagrams document the steps necessary to implement an operation or a business process referenced in a sequence diagram. Activity diagrams provide further detail and show the flow of control among the steps of computation. Activity diagrams can show data flows as well as control flows. Activity diagrams document the steps necessary to implement an operation or a business process referenced in a sequence diagram.

25 www.techstudent.co.cc Use Case Models A use case is a set of scenarios that describing an interaction between a user and a system. A use case diagram displays the relationship among actors and use cases. The two main components of a use case diagram are ‘use cases’ and ‘actors’. An actor is a direct external user of a system. An actor represents a user or another system that will interact with the system you are modeling. Each actor represents those objects that behave in a particular way toward the system. For example, customer and repair technician are different actors for a vending machine. An actor is a person, organization, or external system that plays a role in one or more interactions with your system

26 www.techstudent.co.cc Use Case Models The various interactions of actors with a system are quantized into use cases. A use case is an external view of the system that represents some action the user might perform in order to complete a task. A use case describes a sequence of actions that provide something of measurable value to an actor and is drawn as a horizontal ellipse. A use case is a coherent piece of functionality that a system can provide by interacting with actors.

27 www.techstudent.co.cc Use Case Diagram A system involves a set of use cases and a set of actors. Each use case represents a slice of the functionality the system provides. The set of use cases shows the complete functionality of the system at level of detail. Similarly, each actor represents one kind of object for which the system can perform behavior. The set of actors represents the complete set of that the system can serve. The are helpful in exposing requirements and planning the project. During the initial stage of a project most use cases should be defined, but as the project continues more might become visible.

28 www.techstudent.co.cc Use case diagram for a vending machine

29 www.techstudent.co.cc Guidelines for Use Case Models First determine the system boundary. Ensure that actors are focused. Each use case must provide value to users. Relate use cases and actors. Remember that use cases are informal. Use cases can be structured.

30 www.techstudent.co.cc

31 Sequence Models The sequence model elaborates the themes of use cases. There are two kinds of sequence models: Scenarios and a more structured format called sequence diagrams. A usage scenario is a description of a potential way your system is used. The logic of a usage scenario may be part of a use case, perhaps an alternate course. It may also be one entire pass through a use case, such as the logic described by the basic course of action or a portion of the basic course of action, plus one or more alternate scenarios. The logic of a usage scenario may also be a pass through the logic contained in several use cases. For example, a student enrolls in the university, and then immediately enrolls in three seminars

32 www.techstudent.co.cc Sequence Diagram A scenario can be displayed as a list of text statements. Sequence Diagram A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and the order in which the invocation occurs is captured in a Sequence diagram. This makes the Sequence diagram a very useful tool to easily represent the dynamic behavior of a system. It shows the participants in an interaction and the sequence of messages among them. Also it shows the interaction of a system with its actors.

33 www.techstudent.co.cc Sequence Diagram

34 www.techstudent.co.cc Sequence Diagram Guidelines for sequence models The sequence model adds detail and elaborates the informal themes of use cases. Scenario document a sequence of events with prose. Sequence diagrams also document the sequence of events but more clearly show actors involved. Prepare at least one scenario per use case. Abstract the scenario into sequence diagrams Divide complex interactions. Prepare a sequence diagram for each error condition.

35 www.techstudent.co.cc Advanced Interaction Modeling Use Case Relationships It can be helpful to structure use cases for large applications. Complex use cases can be built from smaller pieces with the include, extend and generalization relationships Include Relationship The Include relationship incorporates one use case within the behavior sequence of another use case. An include use case is like a subroutine. It represents behavior that would otherwise have to be described repeatedly. The representation is a dashed arrow from source to destination. The keyword > annotates the arrow.

36 www.techstudent.co.cc Advanced Interaction Modeling

37 www.techstudent.co.cc Advanced Interaction Modeling Extend Relationship The extend relationship adds incremental behavior to a use case. It is like an include relationship looked at from the opposite direction, in which the extension adds itself to the base, rather than the base explicitly incorporating the extension. It represents some frequent situations in which some initial capability is defined, and later features are added modularity. The include and extend relationship both add behavior to a base use case.

38 www.techstudent.co.cc Advanced Interaction Modeling Extend Relationship

39 www.techstudent.co.cc Advanced Interaction Modeling Generalization In UML modeling, a generalization relationship is a relationship in which one model element (the child) is based on another model element (the parent). A generalization is used to indicate inheritance. Generalization relationships are used in class, component, deployment, and use case diagrams. A parent use case represents a general behavior sequence. Child use case specializes the parent by inserting additional steps of by refining steps.

40 www.techstudent.co.cc Procedural Sequence Models Sequence Diagram with passive objects Sequence Diagram with transient object Special Constructs for Activity Models Sending and receiving signals Swimlanes Swimlanes can show organizational responsibility for activities Object Flows

41 www.techstudent.co.cc Procedural Sequence Models Sequence Diagram with passive objects

42 www.techstudent.co.cc Procedural Sequence Models Sequence Diagram with transient object

43 www.techstudent.co.cc Special Constructs for Activity Models Sending and receiving signals

44 www.techstudent.co.cc Special Constructs for Activity Models Swimlanes Swimlanes can show organizational responsibility for activities

45 www.techstudent.co.cc Special Constructs for Activity Models Object Flows


Download ppt "Www.techstudent.co.cc State Modeling. www.techstudent.co.cc Events An event is an occurrence at a point in time, such as user depresses left button or."

Similar presentations


Ads by Google