01 / 09 / 2022

55. OOP Basics Part 2

There are 4 pillars for Object Oriented Programming.

Inheritance - A class derives from another class, the child class inherit from a parent class which it can have all the public and protected properties and methods from the parent class but also has it's own properties and methods. Code organization.
Polymorphism - In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form. A real-life example of polymorphism is a person who at the same time can have different characteristics.
Abstraction - the concept of wrapping up complex actions in simple verbs. Describe each thing you’ve abstracted clearly, and hide the complexity. Someone can always pop the hood if they need to. Minimize mistakes.
Encapsulation - As much as you can, keep state and logic internal. This can mean have as few attr readers as possible, or as few instance vars as possible. The less you have to keep track off at any given time, the better. For code organization.