ISM 301 Ch6: Behavioral Modelling PDF
Document Details
Tags
Summary
This document provides an overview of behavioral modeling concepts. It describes the purpose and different types of behavioral models used in software design, such as activity and sequence diagrams, and includes a fundamental understanding of state machines. The document also introduces the concept of CRUDE analysis, emphasizing methods and steps for creating effective sequence diagrams.
Full Transcript
Ch6: Behavioral Modelling ISM 301 O-O Systems Development All object‐oriented systems development approaches are use‐case driven, architecture‐centric, and iterative and incremental. Behavioral Model Describes the internal dynamic aspects of an information system that supports the busine...
Ch6: Behavioral Modelling ISM 301 O-O Systems Development All object‐oriented systems development approaches are use‐case driven, architecture‐centric, and iterative and incremental. Behavioral Model Describes the internal dynamic aspects of an information system that supports the business processes in an organization. Diagrams used to describe behavioral model: Unified Modeling Language (UML): Activity diagrams Interaction diagram (Sequence diagrams) Behavioral state machines CRUDE (create, read, update, delete, execute) matrix. Behavioral Model Purpose: to show how the underlying objects in a problem domain will work together to form a collaboration to support each of the use cases. Internal view of the business processes Types of Behavioral Models Type 1: used to represent the underlying details of a business process portrayed by a use‐case model. These are interaction diagrams. Activity Diagram (specifically with swimlanes) Sequence Diagram Type 2: used to represent the changes that occur in the underlying data. Behavioral State Machine Interaction Diagram They allow the analyst to model the distribution of the behavior of the system over the actors and objects in the system. In this way, we can easily see how actors and objects collaborate to provide the functionality defined in a use case. Interaction diagrams focus on the object level. We will start with an illustration of Sequence Diagram Use Case Diagram: Campus Housing System Activity Diagram- Add and Delete Apt Class Diagram Sequence Diagram actor object Messag e lifeline Execution occurrence Return value Sequence Diagram Syntax Steps for Creating Sequence Diagram 1. Set Context: the context can be a system, use case, or a use case scenario. Most common is a use case scenario. 2. Identify actors and objects: Every actor and objects that interact with each other in the use case scenario. Recall that actors are identified in functional model and objects are identified in structural model. So, referring to the activity diagrams (with swim lanes) and class diagrams is a good first step. 3. Set lifelines: Placing the objects in order and drawing a vertical dotted line. It is a good practice to place the initiating actor/object at the left. Steps for Creating Sequence Diagram 4. Add Messages: drawing arrows to represent the messages being passed from object to object, with the arrow pointing in the message's transmission direction. The arrows should be placed in order from the first message (at the top) to the last (at the bottom) to show time sequence. 5. Place execution occurrence: drawing a narrow rectangle box over the lifelines to represent when the classes are sending and receiving messages. 6. Validate: guarantee that the sequence diagram completely represents the underlying process. CRUDE Analysis It is a technique to identify how objects collaborate to support the use cases. A CRUDE matrix is created where interaction among objects is labelled with the type of interaction: C: Create R: Read or Reference U: Update D: Delete E: Execute Making a CRUDE Matrix Identify all the actors and the classes. (Note: refer to the use case diagram and class diagram as a starting point) Identify the type of interactions. (Refer to the activity diagram to identify the type of interactions) Verify the interactions. Behavioral State Machine A behavioral state machine is a dynamic model that shows the different states through which a single object passes during its life in response to events, along with its responses and actions. Some of the classes in the class diagrams represent a set of objects that are quite dynamic in that they pass through a variety of states over the course of their existence. For example, a patient can change over time from being new to current to former based on his or her status with the doctor's office. Behavioral State Machine Typically, behavioral state machines are not used for all objects; rather, they are used with complex objects to further define them and to help simplify the design of algorithms for their methods. The behavioral state machine shows the different states of the object and what events cause the object to change from one state to another. Behavioral state machines should be used to help understand the dynamic aspects of a single class and how its instances evolve over time unlike sequence diagrams that show how a particular use case or use‐case scenario is executed over a set of classes. Elements of Behavioral State Machine State: the value of an object’s attributes and its relationships with other objects at a particular point in time. For example, a patient might have a new, current, or former state. Event: An event is something that takes place at a certain point in time and changes a value or values that describe an object, which, in turn, changes the object's state. E.g., when a patient checks in the hospital, their state is changed to admitted. Transition: Movement of an object from one state to another. For example, when a patient moves from “admitted” to “released”. Guard Condition: is a Boolean expression that includes attribute values, which allows a transition to occur only if the condition is true. E.g., only if the diagnosis of the patient is healthy, their state transition from “admitted” to “released” Example of Behavioral State Machine state guard event s condition transitio n initial final state state Syntax: Behavioral State Machine Diagram Guidelines for Creating Behavioral State Machine Identify objects whose behavior changes based on the state of the object. Place the initial state to the top left and the final state to the bottom. Adhere to simple names for states. Avoid black hole states (states that an object goes into but never comes out of), and miracle states (states an object comes out of but never went into). Guard conditions should be mutually exclusive and not overlapping. For example, healthy and unhealthy are mutually exclusive. Validate the diagram by making sure that each state is reachable and it is possible to leave all states except the final state. Balancing Functional and Behavioral Model The sequence diagram must be associated with a use case. Actors on the sequence diagram must be associated with actors on the use- case diagram. Messages on sequence diagrams, transitions on behavioral state machines, and entries in a CRUDE matrix must be related to activities and actions on an activity diagram and events listed in a use‐case description, and vice versa. All complex objects represented by an object node in an activity diagram must have a behavioral state machine. Balancing Structural and Behavioral Model Objects in CRUDE matrix must be associated with class diagram and vice-versa. The objects on a sequence diagram must be an instantiation of a class. Messages contained on the sequence diagrams, transitions on behavioral state machines, and cell entries on a CRUDE matrix must be associated with responsibilities and associations on CRC cards and operations in classes and associations connected to the classes on class diagrams. States in a behavioral state machine must be associated with different values of an attribute that describes an object. For example, a patient from the behavioral state machine diagram should have an attribute current status in its class definition. End of Chapter Thank you