Kinesia Online Course
Object Oriented Programming
Kinesia LLC, 2003
    1. A Little Taste of Java
    2. Abstraction and Modeling
    3. Objects and Classes
    4. Object Interactions
    5. UML and Relationships between Objects
    6. Collection of Objects
    7. Some Final Concepts
    8. Object Modeling and Use Cases
    9. Modeling of Dynamic Behavaior and Sequence Diagrams
    10. A Deeper Look at Java
    11. Java Layout
    12. Java Events
    
    The supreme quality for leadership is unquestionably integrity.  Without
    it, no real success is possible no matter whether it is on a section
    gang, a football field, in an army, or in an office.
    
    				Dwight David Eisenhower
    
    

    UML and Relationships between Objects

    1. UML ( Unified Modelling Language )

    2. UML is a notation for representing OO designs
    3. It is a consensus among the OO community
    4. It is becoming an OMG (Object Management Group)
    5. It consists notations for class diagrams, use cases, sequence diagrams, and so on ...
    6. class diagrams

      Objects have attributes ( data ) and operations ( methods )

    7. attribute = slot, qualifier, field, instance variable
    8. operation = method, feature, procedure, function, action

    9. Inheritance diagrams

    10. Inheritance allows one type to inherit behaviour from another
    11. Objects in the child class form a subset of objects in the parent class
    12. Inheritance is also referred to as generalisation and subtyping

    13. Relations between Objects

    14. Association ( structural relationship ) = cross-reference, uses, instance connection, relationship
    15. Generalisation = inheritance, subtype
    16. Aggregation = inclusion, containing, part-whole, consists of
    17. Association and Links

      Association says there is a relation between 2 classes

      An attribute is an association where the class is ``small enough'' to fit inside another class.
      We denote it using:

      rather than

      Whereas an association refers to a relationship between classes, the term link is used to refer to a structural relationship that exists between two specific objects ( instances ).

      A link is a specific instance of an association with its member objects. i.e.

    18. An association is a potential relationship between objects of a certain type/class.

    19. A link is an actual relationship between objects of those particular types.
    20. binary association -- association between two different classes

      unary ( reflexive ) association -- association between two instances of same class e.g.

    21. CS 201 ( a Course object ) is a prerequisite for CS 202 ( another Course object )
    22. ternary association, e.g.

    23. A Student attnds a Course
    24. A Professor teaches a Course
    25. A Professor advises a Student
    26. Aggregation

      Aggregation is a special form of association. Maybe referred to alternatively as:

    27. contains
    28. is composed of
    29. is comprised of
    30. is part of
    31. Examples:
    32. A Car contains an Engine
    33. A Car contains a Transmission
    34. A Car contains a Body
    35. A Car is composed of many ( four, in this case ) Wheels

    36. Composition

      Composition is the relation consists of where the components cannot exist independently from the whole. Wheels can exist independently from the car, and are not necessarily destroyed when the car is wrecked The car registration cannot exist without a car

    37. Multiplicity

    38. One-to-one (1:1)
    39. One-to-many (1:m)
    40. Many-to-many (m:m)
    41. This can be shown on the association/aggregation/composition line, where `*' means zero or more

      The following says that a Form can contain many (different) GUI objects, including another Form. This is a potentially recursive structure

    42. Navigability

      An association just says there is a relationship

      The direction may be specified:

      This has implementation implications:

      class Car {
          Wheel wheels[4];
      }
      
      class Wheel {
          // no mention of Car
      }
          	

    43. Rules for Deriving Classes

      The Do's:

    44. Extend the base class by adding features.

    45. You may specialize the way that a subclass performs one or more of the services inherited from the parent class. This is accomplished by overriding. e.g.
        parent has print() method
        child ( sublcass ) has print() method but print differently
    46. The Don'ts:

    47. Whenever possible, avoid having to add features to non-leaf nodes once they have been established in code in an application ( because this may affect the descendants ).

    48. You should not change the 'semantics' -- i.e. the intention, or meaning -- of a feature.
      e.g. if a print() prints something to console, its subclass should not make print() printing data to a file.

    49. You cannot 'ovverride' an attribute.

    50. You cannot physically eliminate features, nor should you effectively eliminate them by ignoring them.

    51. You cannot change the signature of a method.
      You may create a different method entirely by overloading:

      • overloading is supported by non-OO and OO languages.
      • allows two or more different methods belonging to the same class to have the same name as long as they have different argument signature.
        Example:
        boolean print();//no argument
        void print( String filename );//a single argument
        void print( int x ); //a single argument
        boolean print ( double d, String s );//two arguments
    52. Multiple Inheritance

       

    53. complicated, difficult to keep track of parent
    54. Java language designers chose not to support multiple inheritance
    55. Java provides interface for handling the requirement of creating an object with a 'split personality'.
    56. Avoiding multiple inheritance