Skip to content

saadafm/OOP-Overview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Pillars of Object-Oriented Programming

The purpose of this repository is to categorize my notes accordingly to the pillars of OOP. Additionally, the Java projects above all utilize OOP concepts and best practises in one way or another, while some projects may also show poor practise as well.

Table of Contents

  1. General Knowledge
  2. Encapsulation
    • Data Hiding
    • Information Hiding
    • Immutability
    • Access Modifiers
    • Defensive Copying
  3. Inheritance
  4. Abstraction
  5. Polymorphism
    • Dynamic Dispatching
    • Dynamic Binding
    • Method Overriding
  6. Object Relationships
    • Aggregation
    • Composition
    • Collections as Fields
    • Shallow Copy
    • Deep Copy
    • Defensive Copy
  7. Other Key Concepts / Best Practises
    • Enums (Enumerated Types)
    • Class Invariants
    • JUnit



General Knowledge


OOP_PILLAR


gen_knowledge


OOP_Foundational_Knowledge


Potential_Finals_Qs_OOP_2


Potential_Finals_Qs_OOP


pass_by_value_Java


referenceVar-vs-objInstance


outputQuiz



Encapsulation


Encapsulation_accessModifiers


immutability


Information Hiding

Static_Factory_Method


DefensiveCopying



Inheritance


Inheritance_Constructor


inheritance_BP



Abstraction


• What is the difference between Abstract Class and an Interface? AbstractClasses_vsInterfaces

Interface overview

  • The main structural element in Java that enforces an API is an interface
  • An interface contains only constants and abstract methods (with addition to default methods and static methods). The abstract methods are public by default.
  • It has no constructors and can't directly be instantiated
  • A class that implements an interface must implement aLL of the methods declared in the interface (no inheritance); otherwise won't compile
  • A class can have multiple inheritance


  • Abstract Class overview
  • A class extends to an abstract class. (E.g., a Dog IS-A Animal)
  • Methods: Abstract classes can have both abstract methods and concrete methods. Subclasses can inherit these concrete methods as-is or override them, and obviously, subclasses are required to provide their own implementation of abstract methods.
  • Constructors: Abstract classes can have constructors, and when a subclass is instantiated, the constructor of the abstract class is called before the constructor of the subclass.
  • Fields: There are no limitations as to what type of field you would like to declare or initialize in an abstract class.
  • Inheritance (IS-A): Single inheritance; A class can only extend one abstract class. (E.g., a Dog IS-A Animal)
  • Instantiation You cannot create an instance of an abstract class directly using the new keyword. You can only create instances of concrete subclasses of the abstract class.


  • Polymorphism


    polymorphism
  • Says variable husky is declared as Dog Type, but is instanceof and references an object of Husky Type.
  • Polymorphism_Abstraction_andDynamicDispatching

    dynamicDispatching


    Collections as Fields: Shallow Copy vs. Deep Copy


    deepCopy_shallowCopy

    deepCopy_shallowCopy_Aliasing


    deepCopy_WRONGway


    deepCopy_and_CopyConstructor_Relationship


    Object Relationships: Aggregation and Composition


    ObjectRelationships_OOP


    • When implementing a class aimed to demonstrate an aggregation object relationship, do not do this:

    Aggregation_DONT_DO_THIS



    Other Key Concepts / Best Practises

    Enums (Enumerated Types)


    enums


    Java Collections Framework


    JCF


    Class Invariants


    ClassInvariance


    JUnit Framework


    JUnit

    Obligatory Methods


    obligatoryMethods

    Comparable_Interface


    Exceptions


    Exceptions


    About

    A General Overview of Advanced topics in Object-Oriented Programming by Saadaf Mohsin

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

     
     
     

    Contributors