am
🧠

Object Oriented Programming

  • Problem-solving methodology that produces a solution to a problem in terms of self-contained entities called objects
  • Class
    • Description of a group of objects with similar properties and behaviours
    • Any particular object is an instance of a class
    • Contains
      • Fields
        • Named properties
      • Methods
        • Named algorithm defining one aspect of behaviour of a class
        • A function attached to a class
  • Object
    • Entity that makes sense within context of a problem
    • Specific, concrete instances of a class
    • Attributes
      • Characteristics that define an object
      • Differentiate objects of the same class
      • Value of attributes is an object's state
  • Encapsulation
    • Language feature that enforces hiding information

Design Methodology

  • Brainstorming
    • Local possible classes
  • Filtering
    • Find duplicate classes
    • Remove unnecessary classes
  • Scenarios
    • Ensure we understand collaborations
    • Assign responsibilities of each class
      • What the tasks are
      • Two types of responsibilities
        • Knowledge
          • What a class must know about itself
        • Behaviour
          • What a class must be able to do
  • Responsibility algorithms
    • Design for all actions that classes must exhibit

Inheritance

  • Mechanism by which one class acquires the properties (data fields and methods) of another class
  • Superclass
    • Class being inherited from
  • Derived class
    • Class doing the inheriting

Computer Science Programming