OOPS

Major PillarsMinor Pillars
Encapsulation
Abstraction
Polymorphism
Hierarchy
Typing
Persistence
Concurrency

Encapsulation

Binding data and putting it together is called encapsulation.

The process of implementing abstraction is called encapsulation.

Class is the basic unit of encapsulation.

Abstraction always describes outer behavior of object and encapsulation describes inner behavior of object.

Abstraction

Process of getting essential things from an object is called abstraction.

Polymorphism

Polymorphism is the ability of any data to be processed in more than one form. The word itself indicates the meaning as poly means many and morphism means types.

Hierarchy

The level or ranking order of abstraction is called hierarchy.
There are 4 types of hierarchy

  1. Composition: has-a relationship
  2. Inheritance: is-a relationship
  3. Dependency: use-a relationship
  4. Instantiation: creates-a relationship

Inheritance

A journey from generalization to specialization is called inheritance.Its main purpose is to achieve re-usability.


3 minor pillars of OOPS

  1. Typing
  2. Persistence
  3. Concurrency

Typing (polymorphism)

one interface having many behaviors is called polymorphism.

e.g. board can be used for writing or screen projection.

USB ports can be used for a webcam or headphone or mouse.

There are two types of polymorphism

  1. compile time polymorphism
  2. runtime polymorphism

Compile Time Polymorphism

when the function gets called at compile time is called as compile time polymorphism also called as static binding / static polymorphism / early binding / weak typing / false polymorphism.

Run Time Polymorphism

when a call to the function gets resolved at runtime is called runtime polymorphism. It is also called dynamic binding / dynamic polymorphism / strong typing / true polymorphism.

  • Compile time polymorphism can be achieved by operator overloading or function overloading.
  • Runtime polymorphism can be achieved by function overriding.

Persistence

It refers to saving data (usually to a disk) for future access.

Concurrency

Concurrency refers to the potentially parallel execution of parts of a computation. In a concurrent computation, the components of a program may be executed sequentially, or they may be executed in parallel.
In Java concurrency is achieved by implementing Multithreading.