Collaboration and Class Diagrams - thoughts.net

Document Sample
Collaboration and Class Diagrams - thoughts.net Powered By Docstoc
					Collaboration and Class
Diagrams

March 30, 2004
Agenda
  Training Plan Overview
  Review
    Sequence Diagrams
      • Diagram Elements
      • Use in the Models
    Statechart Diagrams
      • State Machines
      • States
      • Transitions
  Collaboration Diagrams
  Class Diagrams
  Exercise
  Next Steps
Training Plan Overview
   Introduction
   Using Rational Administrator
   Using ClearCase
   Using ClearQuest
   Using Rational Rose XDE
   Identifying & Creating Use-Cases – Part 1
   Identifying & Creating Use-Cases – Part 2
   Detailing Requirements with
   RequisitePro
   Actors and Use-Case Diagrams
   Sequence and Statechart Diagrams
   Collaboration and Class Diagrams
   Integration and Development with the .NET Framework
Review - Sequence Diagrams
   Uses
      Show object interaction in a time-based sequence
      Establish the roles of objects
      Provide essential information to determine class responsibilities and interfaces
   Two dimensions
      Vertical representing time
      Horizontal representing different objects
Review – SD – Elements
                         Objects/Classes
                         Lifelines
                         Focus of Control

                         Text (Scripts)
                         Note
                         Note Anchor
                         Class
                         Object Message
                         Message To Self
                         Return Message
                         Destruction Marker
                         Procedure Call
                         Asynchronous Message
Review – SD – Lifeline
   UML Section
     Is Specification
     Collections
     Stereotypes
     Documentation
Review – SD – Messages
   UML Section
     Message Name
      • Simple
      • English
     Alias
     Guard Condition
     Is Specification
     Collections
     Stereotypes
     Message Signature
     Documentation
Review – SD – Messages
   Collections
      Arguments
       •   Name
       •   Type
       •   Value
       •   Stereotype
Review – SD – Messages
   Detail Tab
      Synchronization
       • Simple
           – The message has a single
             thread of control
       • Synchronous
           – The operation proceeds
             only when the client
             sends a message to the
             supplier and the supplier
             accepts the message
       • Balking
           – The client passes a
             message only if the
             supplier is immediately
             ready to accept the
             message; the client
             abandons the message if
             the supplier is not ready
       • Timeout
           – The client abandons a
             message if the supplier
             cannot handle the
             message within a
             specified amount of time.
Review – SD – Messages
   Detail Tab
      Synchronization
       • Procedure Call
           – The operation only
             proceeds on return and
             may return results
       • Asynchronous
           – The client sends a
             message to the supplier
             for processing and
             continues to execute its
             code without waiting for
             or relying on the
             supplier's receipt of the
             message
       • NotASyncType
           – Unspecified
       • Return
           – Returns control and may
             return results
      Frequency
       • Aperiodic
       • Periodic
Review – SD – Control Flow
   Control Flow
     Centralized control of a
     flow of events or part of the
     flow of events means that a
     few objects steer the flow
     by sending messages to,
     and receiving messages
     from other objects
       • Use
            – If the order in which the
              sub-event phases will be
              performed is likely to
              change
            – To insert new sub-event
              phases
            – To keep parts of the
              functionality reusable as
              separate pieces
       • To recognize look for fork-
         shaped structure
Review – SD – Control Flow
    Decentralized control
    arises when the
    participating objects
    communicate directly with
    one another, not through
    one or more controlling
    objects
     • Use
         – If sub-event phases are
           tightly coupled
         – If forming a part-of or
           consists-of hierarchy
         – To form a conceptual
           inheritance hierarchy
         – To represent a fixed
           chronological progression
         – To encapsulate and
           thereby make
           abstractions of
           functionality
     • To recognize look for
       stairway-shaped structure
Review - Sequence Diagrams
   Sub-Sequence
     Use to reduce complexity
     Recognition
      •   Occurs repeatedly in different places
      •   Is expected to be performed repeatedly in future iterations
      •   Is complex but easily encapsulated
      •   Is determined to be encapsulated within a replaceable sequence
Review - Sequence Diagrams




   Transactions
     Define a set of operation invocations which are atomic;
     they are either all performed, or none of them are
     performed
     Beginning / End
      • Textual
      • Explicit Message
Review - States & Transitions
   State
     A condition of an object in which it performs some
     activity or waits for an event.
   Transition
     A relationship between two states which is
     triggered by some event, which performs certain
     actions or evaluations, and which results in a
     specific end-state
   State Machine
     Consists of states, linked by transitions.
     Used To Model Dynamic Behavior
      • Event-driven aspects of the system's behavior
      • State-dependent behavior
Review - Statechart Diagrams
Review - State Properties
   Name
   Entry / Exit Actions
   Internal Transitions
         Transitions that are handled
         without causing a change in
         state
   Substates
         The nested structure of a state,
         involving disjoint (sequentially
         active) or concurrent
         (concurrently active) substates
         Properties
           •   Name
           •   Trigger
           •   Guard Condition
           •   Action
         Pseudo-states
           •   Name
           •   Initial – Final Transition
                  – No Trigger
   Deferred States
         A list of events that are not
         handled in that state but are
         postponed and queued for
         handling by the object in
         another state
Review - State Transition Properties
   Event
     Short Description of why
     an object in the “Source
     State” will perform
     certain actions and enter
     the “Target State”
   Stereotype
   Event Trigger
     The event that makes
     the transition eligible to
     fire
   Guard Condition
     A condition which must
     be satisfied before the
     transition can fire
   Action
Review – Statechart Diagrams
Review – Statechart Diagrams
   Model Sequence             Define Substates
     Set Context               • Expand / Consolidate

     Define Initial / Final   Validate Object/Class
     States                   Use
      • Pre/Post Conditions   Analyze & Re-
     Define Events            analyze
     Define Intermediate
     States
      • Connect with
        transitions
     Define Entry /
     Actions
Review – Statechart Diagrams
   Nested State Machine
      One Initial and One Final
      State
      Composite State
       • Unlimited Depth
      Control Based on
      Transition Type
       • Entry/Exit Action
           – To/From Composite
           – To/From Nested State
               – Via Composite
   History State
      Allows the return to a
      previous sub-state within
      a nested state
Review – Statechart Diagrams
   Abstract State
   Machines
     Need to have more
     detail added before it
     can be used for
     practical purposes
     Utilize Inheritance
      • Root Class
Review – Statechart Diagrams
   Chained States
     Transition Extension
      • Separates the internal
        specification of the
        containing state from its
        external environment
      • Encapsulation
     No internal structure
     Any number of input
     transitions
     May have an outgoing
     transition with no trigger
     event
     Automatically fires when
     an input transition
     activates the state
Collaboration Diagrams
   Used to show how
   objects interact to
   perform the behavior of a
   particular use case
   Used to define and clarify
   the roles of the objects
   that perform a particular
   flow of events of a use
   case
   Are the primary source of
   information used to
   determining class
   responsibilities and
   interfaces
   Better suited to depicting
   simpler interactions of
   smaller numbers of
   objects.
Collaboration Diagrams - Elements
   Elements
     Objects
     Actor instances
     Links
     Messages
   Function
     Describes what takes
     place in terms of
     how the objects
     communicate by
     sending messages to
     one another
Collaboration Diagrams - Links
   A relationship among objects
   across which messages can
   be sent
      Show as a solid line
   Can be an instance of an
   association, or it can be
   anonymous, meaning that its
   association is unspecified.
   An object interacts with, or
   navigates to, other objects
   through its links to these
   objects.
   Message flows are attached
   to links
Collaboration Diagrams - Messages
   Communication
   between objects that
   conveys information
   with the expectation
   that activity will ensue
      Shown as a labeled
      arrow placed near a link
      May contain parameters
      May contain sequence
      numbers
      Two states
       • Unassigned
       • Assigned
Class Diagrams
   Static structure of
   the model
     Objects / Classes
      • Internal structure
          – Attributes
          – Operations
     Relationships to
     other classes
     Do not show
     temporal information
Class Diagrams - Types
   A single class, its attributes, operations, and relationships with
   other classes
   Classes that participate in a specific use-case realization
   Functionally related or coherent classes
   Important aggregation and generalization hierarchies
   Important structures of entity classes
      Class structures
        • Relationships
            – Association
            – Aggregation
            – Generalization
   Design subsystems, classes, interfaces, and their relationships
   Packages
      Classes that belong to the same package
      Dependencies
      Layering
Class Diagrams - Types
Class Diagrams - Elements
   Object / Class
      Stereotypes
       •   Business Actor
       •   Business Worker
       •   Business Entity
       •   Business Use-Case
       •   Actor
       •   Entity
       •   Use-Case
       •   Component
       •   Capsule
   Associations
      Stereotypes
Class Diagrams – Objects / Classes
   Properties
   Window
     UML Section
      •   Name
      •   Stereotype
      •   Multiplicity
      •   Persistence
      •   Abstract
      •   Is Leaf
      •   Is Root
      •   Is Specification
      •   Visibility
Objects / Classes – Stereotype
     Stereotype
      • Objects
         – Boundary
         – Control
         – Entity
      • Classes
         –   Implementation
         –   MetaClass
         –   Powertype
         –   Process
         –   Thread
         –   Type
         –   Utility
Objects / Classes - Stereotypes
     Boundary
      • An object which interfaces with the user
     Control
      • An object that controls a use-case
     Entity
      • An object that participates in a use-case
Objects / Classes - Stereotypes
     ImplementationClass
      • Indicates that the class identifies the physical
        implementation
     MetaClass
      • A class whose instances are other classes that
        conform to the metaclass
     Powertype
      • Indicates that the classifier is a parent and can
        support subclasses
Objects / Classes - Stereotypes
     Process
      • Indicates that the classifier provides the
        implementation for an active object in a
        heavyweight process
     Thread
      • Provides the implementation of an active object
        in a lightweight process
     Type
      • Identifies a class representing a base data type
     Utility
      • Indicates that the classifier has no instances
        but whose attributes and operations have class
        scope
Objects / Classes – Visibility
      Visibility
       • Public
            – The element is visible
               outside of the enclosing
               package and you can
               import it to other
               portions of your model.
               Operations are accessible
               to all clients.
       • Protected
            – The element is accessible
               only to nested classes,
               friends, or to the class
               itself.
       • Private
            – The element is accessible
               only to nested classes,
               friends, or to the class
               itself.
       • Implementation
            – The element is visible
               only in the package in
               which it is defined. An
               operation is part of the
               implementation of the class.
Class Diagrams – Objects / Classes
   Properties
   Window
     Classic Rose
     Section
      •   Type
      •   Concurrency
      •   Space
      •   Language
Objects / Classes - Concurrency
     Concurrency
      •   Sequential
      •   Guarded
      •   Active
      •   Synchronous
Objects / Classes - Attributes
   Attributes Tab
     Show Inherited
     Show Realized
     Attributes
Objects / Classes - Attributes
     Stereotype
     Name
     Content
     Visibility
     TypeExpression
     DefaultValueExpression
     Aggregation
     Alias
Class Diagrams – Attributes
     Changeability
     Collections
     IsByValueIfComposite
     IsDerived
     IsSpecification
     Ordering
     OwnerScope
     Persistence
     QUID
     TargetScope
Objects / Classes - Operations
   Operations Tab
     Show Inherited
     Show Realized
     Operations
Objects / Classes - Operations
     Stereotype
     Name
     Context
     Stereotype
     Visibility
     Collections
     Alias
     Concurrency
     Exceptions
     IsAbstract
Objects / Classes - Operations
                        IsQuery
                        IsRoot
                        IsSpecification
                        OwnerScope
                        PostConditions
                        PostIntDgm
                        PreConditions
                        PreIntDgm
                        Protocol
                        Qualification
                        Quid
Objects / Classes - Operations
     SemIntDgm
     Semantics
     Size
     Time
     Virtual
Objects / Classes - Arguments
     Collections
      • Parameters Tab
Objects / Classes - Parameters
     Stereotype
     Name
     Kind
     TypeExpression
     DefaultValueExpression
     Alias
     Collections
     IsSpecification
     Quid
Objects / Classes - Associations
Objects / Classes - Associations
                       Stereotype
                       Name
                       Context
                       Kind
                       Collections
                       Alias
                       Characteristics
                       IsDerived
                       IsSpecification
                       Language
                       Persistence
                       Quid
Objects / Classes - Associations
     End?Changeability
     End?Friend
     End?InitialValueExpression
     End?Multiplicity
     End?Name
     End?Ordering
     End?Quid
     End?Stereotype
     End?SupplierName
     End?TargetScope
     End?TypeExpression
     End?Visibillity
Objects / Classes - Associations
   Stereotypes
     Abstraction
      • A type of dependency relationship that relates two model
        elements (or sets of model elements) that represent the same
        concept at different levels of abstraction or from different
        viewpoints
     Aggregation
      • A relationship that indicates that one classifier is a part of or
        subordinate to another classifier
     Binding
      • A type of dependency relationship that assigns values to
        template parameters in order to generate a new model
        element (a class or collaboration) from the template (a
        template class or template collaboration)
     Composition
      • A relationship that represents a "whole/part" relationship
Objects / Classes - Associations
   Stereotypes
     Dependency
      • A dependency relationship indicates that a change to one
        model element (the supplier) may cause a change in the other
        model element (the consumer)
     Deploy
      • A deploy relationship indicates the specific component
        instances that a single node instance deploys or uses
     Directed
      • A directed association is an association relationship that is
        navigable in only one direction, indicating that the control flows
        from one classifier to another (for example, from an actor to a
        use case)
     Extend
      • An extend relationship specifies that the behaviors defined in
        one use case (extension use case) can be inserted into another
        use case (base use case)
Objects / Classes - Associations
   Stereotypes
      Generalization
       • A generalization relationship (sometimes called an is-a relationship)
         indicates that a specialized (child) model element is based on a general
         (parent) model element
      Include
       • An include relationship specifies that a base use case uses the behavior
         defined in another use case (inclusion use case)
      Realization
       • A realization is a relationship that exists between two model elements
         when one of them must realize, or implement, the behavior specified
         by the other
      Reside
       • A reside is a relationship that indicates that a class or component
         resides in a component or artifact
      Usage
       • A usage relationship is a type of dependency relationship in which one
         model element requires the presence of another model element (or set
         of model elements) for its full implementation or operation
Associations – Qualifiers
                      Stereotype
                      Name
                      Visibility
                      TypeExpression
                      DefaultValueExpressi
                      on
                      Aggregation
                      Alias
                      Changeability
                      Collections
Associations – Qualifiers
     IsByValueIfComposition
     IsDerived
     IsSpecification
     Ordering
     OwnerScope
     Persistence
     Quid
     TargetScope
Objects / Classes - Classifiers
                       Stereotype
                       Name
                       IsAbstract
                       IsLeaf
                       IsSpecification
                       Persistence
                       Visibility
                       Collections
Objects / Classes - Classifiers
     Alias
     Concurrency
     IsActive
     Language
     Multiplicity
     Quid
     Space
     Type
Objects / Classes - Component
                     Stereotype
                     Name
                     Visibility
                     ConsumerContext
                     Alias
                     Collections
                     IsSpecification
                     Quid
Objects / Classes - Relationships
     Stereotype
     Name
     To
     Collections
     Alias
     Friend
     IsSpecification
     Quid
     Virtual
     Visibility
Next Steps
   Homework
     Homework Model
      • Explode Classes
         – Use property elements
      • Add Class Diagrams
         – Use modeling elements

   Classes Ahead
     Integration and Development with the
     .NET Framework

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:7
posted:3/3/2012
language:
pages:61