Page 165 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 165

Unit 13: Class Design




               Most organisations provide no reward for reusability; sometimes productivity is measured  Notes
               in terms of new lines of code written plus a discounted credit

          Corollary 4: Strong Mapping

               A strong mapping links classes identified during analysis and classes designed during the
               design phase e.g., view and access classes.
               The analyst identifies objects’ types and inheritance, and thinks about events that change
               the state of objects.

               The designer adds detail to this model perhaps designing screens, user interaction, and
               client-server interaction.

          Corollary 5: Standardisation

               To reuse classes, we must have a good understanding of the classes.

               Most object-oriented systems come with several built-in class libraries.
               But these class libraries are not always well documented.
               Sometimes they are documented, but not updated.
               They must be easily searched, based on users’ criteria.

          Corollary 6: Designing with Inheritance

               When we implement a class, we have to determine its ancestor, what attributes it will
               have, and what messages it will understand.
               Then we have to construct its methods and protocols.
               Ideally, one has to choose inheritance to minimise the amount of program instructions.

               The primitive form of reuse is cut-and-paste reusability.
          Now let us see the process of achieving multiple inheritance in a singe inheritance system:
               Single inheritance means that each class has only a single super class.
               The result of using a single inheritance hierarchy is the absence of ambiguity as to how an
               object will respond in a given method.
               We simply trace up the class tree beginning with the object’s class, looking for a method
               of the same name.

               But languages like LISP or C++ have a multiple inheritance scheme whereby objects can
               inherit behavior from unrelated areas of the class tree.

               The complication here is how to determine which behavior to get from which class,
               particularly when several ancestors define the same method.
               One way of resolving this is to inherit from the most appropriate class and add an object
               of mother class as an attribute or aggregation. The other is to use the instance of the class
               (object) as an attribute.




              Task       Make distinction between stamp coupling and data coupling.




                                           LOVELY PROFESSIONAL UNIVERSITY                                   159
   160   161   162   163   164   165   166   167   168   169   170