word 97

Document Sample
word 97 Powered By Docstoc
					Object Oriented Design
-    we can generally model an object oriented system with the following Object Modeling Technique
     (OMT) diagrams [Gamma, et al, Design Patterns, Appendix B]:
1) class diagram: depicts classes, their structure, and the static relationships between them
2) object diagram: depicts a particular object structure at run time
3) interaction diagram: shows the flow of the requests between objects

Class diagram
-   a class is denoted by a box with the name in bold type at the top (separated by line)
-   group the relevant methods before the data members (separate by line)


             Type method1()

             Type variable1

-   details are optional; method return type, variable type, access privilege, function argument list are
    optional. Include them if they are relevant to your design.
-   Abstract base classes (ABC) are represented similar to class but name written in italic font.
-   virtual function are italicized (pure virtual show =0), data member is not italicized

-   inheritance (IS-A) relation is represented by a line joining the base class to the subclass with the
    triangle pointing to the base class


                                             Type method1()

                                             Type variablex

               ConcreteClassName                                             ConcreteClass2

               Type method1()                                                Type method1()

               Type variable1                                                Type variable3
Class relationships
- different lines denote various relations between classes

           Drawing                                        Shape

                                       for_each shape {                                          CircleShape

                                                          LineShape                              Color

-   a solid line means a reference (or pointer) to an object
-   a dashed line means this class creates an instance of another class (with new, or as function parameter)
-   a diamond base mean this is an aggregation (data member)
-   a solid arrowhead means one instance of object
-   a filled circle at arrowhead means “more than one” object; diamond base with circle arrowhead means
    a collection (container) of more than one objects
-   tip: put the arrow base beside the member name it represents
-   pseudocode annotation, dashed line with circle near method name with box

Object Diagram
-   the class diagram give the static relation between classes, the object diagram
-   provides a snapshot of the object instances at run time
-   the boxes are rounded, object names have a or an in front of classname to indicate instance of object


            shape[0]                                          aCircleShape



-   arrowhead indicates referenced object
-   give instance when this interaction occurs: when the user joins a circle to a line, etc.
Interaction diagram
-      shows the order in which requests between object are executed
-      time flows from top to bottom in an interaction diagram

                  aCreationTool                        aDrawing                              aLineShape

                              new LineShape

                              Add(aLineShape)                     Refresh()


-      solid vertical lines indicate lifetime of particular object
-      naming convention for instantiated object is the classname prefixed by letter “a” (eg. aDrawing)
-      if object doesn’t get instantiated until after beginning of time, then its vertical line is dashed until
       creation point (see aLineShape above)
-      a vertical rectangle means object is active; executing object code
-      horizontal arrows indicates an operation has sent a request to another object
       - name of the request (operation) is shown above the arrow
-      a request to create an object is shown with a dashed arrow (line new LineShape)
-      a call to a member function is an arrow pointing to itself (like Refresh())

-      the above diagram shows that first request is from aCreationTool to create aLineShape object.
-      then aCreation tool calls the Add() method of aDrawing with aLineShape
-      then aDrawing send a Refresh() request to itself
-      then aDrawing sends a Draw() request to the to aLineShape object

Shared By:
Tags: word
Description: word 97