An Introduction to Object-Oriented Systems Analysis and Design

Document Sample
An Introduction to Object-Oriented Systems Analysis and Design Powered By Docstoc
 UML2 Sequence Diagrams
                  Behavioral Models

   Behavior models describe the internal dynamic
    aspects of an information system that supports the
    business processes in an organization.
   Behavioral models describe what the internal logic
    of the processes is without specifying how the
    processes are to be implemented.
   One of the primary purposes of behavioral models is
    to show how the underlying objects of the problem
    domain will collaborate to support each of the use
               The Sequence Diagram

   Illustrates the objects that participate in a use case
    and the messages that pass between them over
    time for one use case.
   Is a dynamic model that shows the explicit sequence
    of messages that are passes between objects in a
    defined interaction.
   Since sequence diagrams emphasize the time-
    based ordering of the activity that takes place
    among a set of objects, they are very helpful for
    understanding real-time specifications and complex
    use cases.
The Sequence Diagram
                                                                                           Regis Auto Rental - Reserve a Vehicle

                   UserInterface            UCController         RentalLocation            CustomerProfile        Customer            VehicleInventory         Vehicle           ProtectionProduct       Reservation

Customer indicates         1: Make a reservation
he wishes to make a
reservation. System           2: Prompt for ID
prompts for ID
Customer enters ID           3: Enter profile ID
                                                                 4: Obtain profile
number. System
obtains customer rental                                         5: Obtain Customer
profile, and personal
info.                   6: Promput for location, etc.

System prompts for       7: Provides location, etc.
location, dates, times &
vehicle category
                                            8: Retrieve vehicles for dates/times

                                                                                                  9: Retrieve Vehicles

                                                                                                                                               10: Match criteria?

System presents         11: Show matching vehicles
matching vehicles &
base rates
                            12: Select a Vehicle
Customer selects a                                          13: Prepopulate profile info
vehicle to rent
                                                                          14: Get customer info

                                                                                                        15: Get protection products

                                                                                                                                                                                    16: Find prot, prod by state, etc.

System prompts for    17: Prompt fo complete info
customer info;
prepopulate from
profile if present.  18: Customer indicates choices
System prompts for
acceptance of                                                                                                   19: Populate with reservation info
protection products.
                                                                                                                                                         20: Get email address

                                                                                                                  22: Get confirmation number

System presents 23: Show reservation & confirmation
reservation details &
                                                                                     Regis Auto Rental - Reserve a Vehicle – Part 1
                                                                                                  Customer selects vehicle to reserve

                     Chris : UserInterface           Home : JSP         ShowInventory : JSP             :RsvnServlet : JSP           :RentalLocation          :VehicleInventory                    :Vehicle                : DataAccess

Customer visits home
page, and enters                     1: Show home page
location, dates, times
and vehicle category.
                                  2: Show matching vehicles
Customer submits request
for listing of matching
vehicles for the chosen
location.                                                         3: POST "Vehicle List", "location", dates
 Home page invokes
 Reservation servlet to
 process FORM data with the
 action = “Vehicle List”.
                                                                                                                       4: <<create>>
 Servlet create empty
 RentalLocation and asks
 object to populate itself with                                                                                    5: populate (locationID)
 data for the selected
 RentalLocation.                                                                                                                                                      6: retrieveLocation (locationID)

RentalLocation populates
its instance variables with                                                                                                                              7: fill (dbRecord)
fields from DB record.
                                                                                                                      8: validate (dates)

Servlet asks RentalLocation                                                                                                  OK
to validate that it can service
a reservation for the                                                                                                                9: <<create>>
selected dates and times.
                                                                                                                    10: populate (location, dates, VehicleCategory)
Servlet creates empty                                                                                                                                                                 11: retrieveVehicles (this)
VehicleList and asks
this object to populate
itself with Vehicles for                                                                                                                                                                                      12: <<create>>
the location designated
                                                                                                                                                                                                          13: fill (dbRecord)
by the customer.
                                                                                                                                                                                                              14: add (aVehicle)

                                                                                                                                                         15: Store vehicle collection in session

  System displays all                                                                                                        Shows                       16: ReqDispatcher.forward to ShowInventory page
  available vehicles
  matching Customer                                      17: Shows all available vehicles
  selection criteria.
                                                        Sequence Model
                                                           Add Visit

Provider        ChocAn      PersonCatalog              Input             Member          Provider    ServiceCatalog   Service   Visit















                                                                   recordVisitInfo(member, provider, service)


    Guidelines for Building Sequence Diagrams

   Determine the context of the sequence diagram.
    –   The context of a diagram can be a system, a use case, a scenario of
        a use case, or an operation of a class.
    –   The context of the diagram is depicted as a labeled frame around the
    –   Most commonly, it is one use case scenario.
   Identify the objects that participate in the sequence being
    modeled – that is, the objects that interact with each other
    during the use case scenario.
    –   The objects are identified during the development of the structural
        model (class diagram).
    –   These are the classes on which the objects of the sequence diagram
        for this scenario will be based. Set the lifeline for each object. To do
        this, you need to draw a vertical dotted line below each class to
        represent the class’s existence during the sequence. An “X” should
        be placed below the object at the point on the lifeline where the
        object goes out of existence.
    Guidelines for Building Sequence Diagrams

   Add messages to the diagram.
    – The arrows should be placed in order from the first
      message (at the top) to the last (at the bottom) to show
      time sequence.
    – Any parameters passed along with the messages should
      be placed in parentheses next to the message’s name.
    – If a message is expected to be returned as a response to
      a message, then the return message either can be or not
      be shown on the diagram.
   Place the execution occurrence of each object’s
    lifeline by drawing a narrow rectangle box over the
    top of the lifelines to represent when the classes are
    sending and receiving messages.
    Guidelines for Building Sequence Diagrams

   Finally, validate the sequence diagram.
    – The purpose of this step is to guarantee that the sequence
      diagram completely represents the underlying processes.
    – This is done by guaranteeing that the diagram depicts all
      the steps in the process.
    – You should refer back to the scenario’s use case details
      and your static class diagram.
    – NOTE: All methods on the class diagram should be shown
      as messages on the sequence diagram.
         More Guidelines – Sequence Diagrams

   Strive for Left-To-Right ordering of messages
   Name actors consistently with your use case
   Name classes consistently with your class diagrams
   An actor can have the same name as a class
   Place human and organizational actors on the left-
    most side of your diagram
   Place reactive system actors on the right-most side
    of your diagram
                 Guidelines for Messages

   Justify message names beside the arrowhead
   Create objects directly
   Use prose for messages involving human and
    organization actors
   Prefer names over types for parameters
   Indicate types as parameter placeholders
   Apply the <<include>> stereotype for use case
               Guidelines for Return Values

   Do NOT model a return value when it is obvious
    what is being returned
   Model a return value only when you need to refer to
    it elsewhere
   Justify return values beside the arrowhead
   Indicate types as return value placeholders
   Explicitly indicate the actual value for simple values
Nested Activity (Includes)
Branching or Alternatives
              Sequence Diagram Resources

   IBM:
    – http://www-

   Agile Modeling:

Shared By: