Page 61 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 61

Unit 5: Advanced Class Modelling – II




          There are various themes for forming packages: dominant classes, dominant relationships,  Notes
          major aspects of functionality, and symmetry.

                 Example: Many business systems have a Customer package or a Part package; Customer
          and Part are dominant classes that are important to the business of a corporation and appear in
          many applications.




             Notes An object model of a compiler could be divided into packages for lexical analysis,
            parsing, semantic analysis, code generation, and optimization.




             Did u know? Once some packages have been established, symmetry may suggest additional
            packages.

          On the basis of our experience in creating packages, we can offer the following tips:

               Carefully delineate each package’s scope: The precise boundaries of a package are a matter
               of judgment. Like other aspects of modeling, defining the scope of a package requires
               planning and organization. Make sure that class and association names are unique within
               each package, and use consistent names across packages as much as possible.

               Make packages cohesive: There should be fewer associations between classes that appear
               in different packages than between classes that appear in a single package. Classes may
               appear in multiple packages, helping to bind them, but ordinarily associations and
               generalizations should appear in a single package.

               Define each class in a single package: The defining package should show the class name,
               attributes, and possibly operations. Other packages that refer to a class can use a class icon,
               a box that contains only the class name. This convention makes it easier to read object
               diagrams because a class is most prominent in its defining package. It ensures that readers
               of the object model will not become distracted by possibly inconsistent definitions or be
               misled by forgetting a prior class definition. This convention also makes it easier to
               develop packages concurrently.




              Task       Discuss the purpose of tab in packages.


          5.4.1  Logical Horizon

          You can often use a class with a large logical horizon as the nucleus for a package. The logical
          horizon of a class is the set of classes reachable by one or more paths terminating in a combined
          multiplicity of “one” or “zero or one.” A path is a sequence of consecutive associations and
          generalization levels. When computing the logical horizon, you may traverse a generalization
          hierarchy to obtain further information for a set of objects. You may not, however, traverse to
          sibling objects, such as by going up and then down the hierarchy. The logical horizons of
          various classes may, and often do, overlap.


                 Example: Figure 5.5 shows the computation of the logical horizon for FlightReservation.



                                           LOVELY PROFESSIONAL UNIVERSITY                                   55
   56   57   58   59   60   61   62   63   64   65   66