Behavioral Model

  1. Behavioral Model
    - Systems have static &dynamic characteristics

    - Describes the internal behaviors of a system that supports the business processes -> dynamic view of the system

    -One of the primary purposes of behavioral models is to show how the underlying objects in the problem domain will collaborate to support each use case.

    • -Where as structural models represents the objects and relationships between objects, behavioral models depict the internal view of the business process that a use
    • case describes.

    -Modeling focus is at the object level.
  2. Systems have static &dynamic characteristics
    ·     Structural models describe the static aspects of the system

    ·     Behavioral models describe the dynamics and interactions of the system’s components; show how the classes described in the structural models interact.
  3. Key UML behavioral models
    • ·Interaction diagrams:
    •      sequence diagram, communication diagram

    ·      State Machines
  4. Interaction Diagrams
    -     An interaction is a behavior that comprises a set of messages exchanged among a set of objects within a context to accomplish a purpose.

    -       Interaction diagrams show those interactions between objects including the messages that may be dispatched among them

    -       You model the dynamic aspects of a system using interaction diagram.  
  5. You model the dynamic aspects of a system using interaction diagram
    • ·      To model the flow of control within an operation, an object, a component, a use case, or the system as a
    • whole.

    ·      To visualize, specify, construct, and document the dynamics of a particular set of objects.
  6. Interaction Diagram Components
    • Object
    • Operations
    • Message      
    • Two types of interaction diagrams in UML
  7. Object
    Instance of class
  8. Operations
    Behaviors of an object
  9. Message
    ·      A message is information sent to an object to tell the object to execute one of its behaviors (function or procedure). A message is a specification of a communication between objects

    ·      Involves the invocation of an operation or the sending of a signal. Essentially a message is a function or procedure call from one object to another.

    ·      When you pass a message, the result is an action.
  10. When you pass a message, the
    result is an action.
    i)     Call – invokes an operation on an object

    ii)     Parameter - specifies the data that must be supplied to an object to carry out a specific operation

    iii)     Return – returns a value to the caller
  11. Two types of interaction diagrams in UML
    • ·      Sequence diagram
    • ·      Communication diagram
  12. Sequence Diagrams
    - Illustrate the objects that participate in a use-case and the messages that pass between objects over time for a particular use-case

    - A sequence diagram is a dynamic model that shows the explicit sequence of messages that are passed between objects in defined interaction.

    - When an object passes a message to another, the receiving objects might in turn send a message to another object. This stream of messages forms a sequence.

    - A sequence diagram emphasizes the time ordering of messages.
  13. Sequence Diagram Syntax
    -A frame indicates the context of the sequence diagram.
  14. Actor and Object
    ·      Actors and objects that participate in a sequence by sending and/or receiving messages

    ·      Actors and objects are placed across the top of the diagram using actor and object symbol.
  15. Lifeline
    It shows the life of an object during a sequence. It is a vertical dashed line that represents the existence of an object over a period of time.
  16. Execution occurrence
    • ·      It is a long, narrow rectangle placed onto a lifeline. It shows the period of time during which an object is performing an action either directly or through a subordinate
    • procedure

    ·      A thin rectangular box is overlaid onto the lifeline to show when the objects are sending and receiving messages.
  17. Object destruction
    An X is placed at the end of the object’s lifeline to show that it is going out of existence.
  18. Message (syntax)
    ·      Conveys information from one object to another one

    ·      Call messages are shown using solid lines connecting two objects with an arrow on the line showing which way the message is being passed

    ·      Return message is depicted as a dashed line with an arrow on the end of the line portraying the direction of the return.
  19. Drawing Sequence Diagram
    Step 1: Determine the context of the sequence diagram

    Step 2: Identify which objects will participate

    Step 3: Set the lifeline for each object      

    Step 4: Layout the messages from the top to the bottom of the diagram based on the order in which they are sent

    Step 5: Add the execution occurrence to each object’s lifeline      

    Step 6: Validate the sequence diagram
  20. Communication Diagrams
    object diagram that shows message passing relationships

    emphasize the flow of messages among objects, rather than timing and ordering of messages

    Displays object interactions organized around objects and their links to one another

    if you are interested in understanding the flow of control over a set of collaborating objects, you should use communication diagram
  21. Communication Diagram Syntax
    -       Actor: a person or system that uses the system; external to the system

    -       An object: participates in a sequence by sending and /or receiving message

    -       An association: shows an association between actors and/or objects

    -       A message: conveys information form one object to another one

    -       Two features that distinguish them from sequence diagrams
  22. Two features that distinguish them from sequence diagrams
    • ·      Path -> to indicate how one object is linked to
    • another

    ·      Sequence number -> to indicate the time order of a message
  23. Building a Communication Diagram
    -       Determine the context of the Communication diagram

    -       Identify the participating objects and their associations. Place objects that participate in the interaction as the vertices in a graph

    -       Layout objects and associations. Render the links that connect these objects as the arcs of this graph

    -       Add messages. Adorn these links with the messages that objects send and receive

    -       Validate the sequence diagram
  24. State Machine Diagrams
    -       State Machine -> 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

    -      shows the different states of the object and what events cause the object to change from one state to another

    -      Typically not used for all objects -> Just for complex ones

    -      Used to understand  the dynamic aspects of a single class and how its instances evolve over time
  25. Components of State Machine Daigram
    -       States

    -       Initial state and final state

    -       Events

    -       Transitions
  26. States
    Values of an object’s attributes at a point in time
  27. Events
    ·    Change the values of the object’s attributes

    ·     Something that takes place at a certain point in time and changes a value that describes an object which changes an object’s state
  28. Transitions
    ·     Movement of an object from one state to another

    ·     Some transition can have a guard condition which is Boolean expression that includes attribute values, which allows a transition to occur only if the condition is true

    ·     A line with an arrow
  29. Building State Machines
    -       Set the context

    -       Identify the initial final, and stable states of the object

    -       Determine the order in which the object will pass through stable states

    -       Identify the events, actions, and guard conditions associated with the transitions

    -       Validate the State Machine
Card Set
Behavioral Model
Behavioral Model Cards