Docstoc

Chapter 4

Document Sample
Chapter 4 Powered By Docstoc
					              Lesson 08
OO Design Techniques
                (Part 2)
Which Steps to Follow …
  This is going to sound abstract, but the goal of OO Design
   is “… the realization of Use Cases through the specialization
   of all detailed system processing steps for each use case …”
  The overall design process can be summarized in the
   following steps :
      1) Develop the 1st cut Design Class Diagram showing navigation
         visibility
      2) Design each Use Case by developing a Detailed Sequence Diagram
         for each
          a) Develop the 1st cut Detailed Sequence Diagram based upon the System
             Sequence Diagram
          b) Then add the layers (domain, view and data access) to the sequence
      3) Update the Design Class Diagram by adding method signatures and
         navigation information
      4) Partition the solution into Packages as appropriate (generating a
         Package Diagram)

Lesson 8 - OO Design
Putting it Together …
  Let’s say we want to flesh out the design for our system
    as far as a particular use case is concerned in our
    fictitious catalog ordering system
       Use Case : Maintain Product Information – start with SSD




Lesson 8 - OO Design
1st Cut Design Class
Diagram
- add controller and add navigation




  Lesson 8 - OO Design
1st Cut Detailed Sequence Diagram
- replace :System object with Controller and add other Domain objects (from Class Diagram)




  Lesson 8 - OO Design
1st Cut Detailed Sequence Diagram
- putting it all together and fleshing out the logic / design




  Lesson 8 - OO Design
The Domain, the View and the
                 Data Access …
    (Step 2b of the OO Process)
  So now we have our 1st cut Detailed Sequence Diagram
    which is a Use Case Controller plus classes from the
    domain layer
       Now we need to add the data access layer
             design for data access classes for separate database interaction
             Separation of responsibilities
       Then we can add the view layer
             design for user-interface classes
             Forms added as windows classes to sequence diagram between
              actor and controller




Lesson 8 - OO Design
Approaches to Data Access …
Using/Calling the
Data Access Layer
- two different methods of
accessing / instantiating objects




  Lesson 8 - OO Design
  Create the Data Access class for each Domain class
       CustomerDA added for Customer
         Database connection statements and SQL statements separated into data
          access class. Domain classes do not have to know about the database design
          or implementation
       Approach (a) – controller instantiates new customer aC,
        and the new instance asks DA class to populate its
        attributes reading from the database
       Approach (b) – controller asks DA class to instantiate
        new customer aC. DA class reads database and passes
        values to customer constructor

  The following 2 examples use Approach (b)




Lesson 8 - OO Design
Adding the DA Layer to the Lookup Item Availability UC




  Lesson 8 - OO Design
Adding the DA Layer to the Maintain Product Information UC




  Lesson 8 - OO Design
Approaches to View Layer …
  What are we really doing in to the Sequence Diagram
    by adding the View Layer components ?
       We are adding GUI forms and/or Web pages between
         actor and controller for each use case
             The overall goal of each GUI is to minimize business logic
              attached to a form


  The representation of some use cases only require one
    form while others require multiple forms and dialog
    boxes
       The View Layer Design is focused on high-level
         sequence of forms/pages – the dialog between the actors
         and the system

Lesson 8 - OO Design
Adding View Layer (ProductQuery) to the Lookup Item
Availability UC




 Lesson 8 - OO Design
Complete Sequence Diagram for Lookup Item Availability UC




  Lesson 8 - OO Design
Adding View Layers (ProductWindow and MsgWindow) to the
Maintain Product Information UC




  Lesson 8 - OO Design
Complete Sequence Diagram for Lookup Item Availability UC




  Lesson 8 - OO Design
If you prefer not to use Sequence
                      Diagrams …
  Communication Diagrams are very similar to System
    (and Detailed) Sequence Diagrams
       Both are interaction diagrams
       Both capture and convey the same information
       In developing either diagram, the Analyst needs to put
         in as much forethought about the design – so in the end,
         the process of designing is same for both
  Which model you use (Communication vs. Sequence)
    is your personal preference.
       We’ve seen and reviewed the steps required to produce a
        Detailed Sequence Diagram
       The main thrust of the Communication Diagram is to
        emphasize coupling


Lesson 8 - OO Design
Symbols Used in a Communication Diagram




Lesson 8 - OO Design
Communication Diagram for Look Up Item Availability UC




Lesson 8 - OO Design
Complete Communication Diagram for Lookup Item
Availability UC – using iconic symbols




 Lesson 8 - OO Design
     After you’ve created the
Sequence or Communication
                    Diagram
  (Step 3 of the OO Process)
  To this point, through Steps 1, 2a and 2b – we’ve taken the
    1st cut of the Design Class Diagram and we’ve developed our
    Interaction (Detailed Sequence or Communication)
    Diagrams
       In doing so, we have potentially identified new classes for the
         View Layer, the Data Access Layer and other Special
         Controller Classes along with the Domain Model’s Entity
         Classes
  Through the Sequence Diagram’s / Communication
    Diagram’s messages
       We’ve potentially identified methods and/or objects/data that
         need to exist within these various classes
             Constructor methods , attribute Get and Set methods, Use case
              specific methods
  We need to add this new found detail into the Design
    Class Diagram
Lesson 8 - OO Design
     More detailed Design Class Diagram for
     ProductItem Class




Lesson 8 - OO Design
Updated
Detailed
Design Class
Diagram for
the System




 Lesson 8 - OO Design
Grouping Classes into Sub-
                  Systems
(Step 4 of the OO Process)
  The Package Diagram is a high-level UML diagram
    used to associate classes of related groups
       Identifies major components of a system and their
        dependencies
       Determines final program partitions for each layer that
        has been added throughout the design
             View, domain, data access
       Can divide system into subsystem and show nesting
         within packages




Lesson 8 - OO Design
Package Diagram drawn per Sub-System with details of
the 3 layers where applicable




 Lesson 8 - OO Design

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:6
posted:11/22/2011
language:English
pages:33