Introduction
In Object-oriented programming, we bundle or combine related functions and variables into something called a Class. Through the help of the class, we created objects and using objects you access variables and functions/methods in that Class. If functions or variables are defined Public. We refer to the class variables as Properties and functions as Methods.
Class vs Objects
Class | Object |
It is a Blueprint of a House | It is created based on blueprint |
you can have more objects for one class | |
Each object is different | |
House itself is an object |
Why OOP?
Better Code Structure
Easier to maintain
Modular & Extendable
Polymorphism Flexibility
Procedural Programming can be used for small scale Projects. But for scalability, we use OOPs.If we use OOPs doesn't use this means it will automatically be easier to maintain, it's a developer how they utilize it.OOPs makes it easier for you to write such code.
OOP not equal to MVC
OOP is the Programming paradigm.
MVC is an architectural pattern that uses OOPs.
OOP Types
Encapsulation
Inheritance
Abstraction
Polymorphism