Page 10 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 10

Object Oriented Analysis and Design




                    Notes              Each object “knows how to perform its operation.” This burden is on the class and not the
                                       caller of the operation.
                                       OOP selects the method to implement an operation based on the name and class of the
                                       operation. The user of an operation need not be aware of implementation details.
                                       Inheritance: Inheritance is a mechanism for sharing similarities among classes while
                                       preserving their differences. Classes are typically defined broadly (higher level of
                                       abstraction) and then refined into subclasses (lower level of abstraction).
                                       Each subclass “inherits” all of the properties of the superclass and adds its own unique
                                       properties. You can use an existing class to derive a new class. Derived classes inherit the
                                       data and methods of the superclass. However, they can overwrite existing methods, and
                                       also add new ones. Properties (both data and behavior) of the superclass need not be
                                       repeated in the subclass.

                                       The ability to abstract common properties of several classes into one common superclass
                                       and inherit the properties from the superclass can greatly reduce repetition within designs
                                       and programs (at the cost of coupling).


                                          Example: Class ‘employee’ and class ‘customer’ are derived from the class ‘person’
                                   New classes can be added without changing code given that methods are provided for each
                                   applicable operation on the new class. Inheritance is used to model an “is a” relationship. A
                                   subclass is always an instance of the superclass.

                                       !
                                     Caution Be careful, the reverse is not true.




                                      Task       Explain the concept of “Identity” with example.


                                   1.1.1  Uses of Object Orientation

                                   Below are some of the advantages of object-oriented programming:
                                       Complex software systems become easier to understand, since object-oriented structuring
                                       provides a closer representation of reality than other programming techniques.

                                       In a well-designed object-oriented system, it should be possible to implement changes at
                                       class level, without having to make alterations at other points in the system. This reduces
                                       the overall amount of maintenance required.
                                       Through polymorphism and inheritance, object-oriented programming allows you to
                                       reuse individual components.
                                       In an object-oriented system, the amount of work involved in revising and maintaining
                                       the system is reduced, since many problems can be detected and corrected in the design
                                       phase.
                                   Achieving these goals requires:

                                       Object-oriented programming languages: Object-oriented programming techniques do
                                       not necessarily depend on object-oriented programming languages. However, the efficiency





          4                                 LOVELY PROFESSIONAL UNIVERSITY
   5   6   7   8   9   10   11   12   13   14   15