Pillars of OOP
Encapsulation: The bundling of data and the methods that act on that data such that access to that data is restricted from outside the bundle. This means that an object stores its state privately, and only the object’s methods have access to change it.
Abstraction: Abstraction is an extension of encapsulation. It is the process of selecting data from a larger pool to show only the relevant details to the object.
Inheritance: Inheritance is the ability of one object to acquire some/all properties of another object.
Polymorphism: Polymorphism gives us a way to use a class exactly like its parent so there is no confusion with mixing types.
Principles
SOLID
- S - Single Responsibility a class should be having one and only one responsibility
- O - Open / Closed classes should be open for extension but closed for modification
- L - Liskov Substitution parent classes should be easily substituted with their child classes without blowing up the application
- I - Interface Segregation many client specific interfaces are better than one general interface
- D - Dependency Inversion classes should depend on abstraction but not on concretion
Patterns
MVC: The MVC (Model-View-Controller) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. This is done to separate internal representations of information from the ways information is presented to and accepted from the user