Object-oriented programming (OOP) is a software development paradigm which encourages scultping desired entities with properties and methods in named classes to create applications.
OOP relies on two major concepts: the class and the object - these foundational concepts applied in code enable us to build applications.
Classes that have been instantiated in our code become objects that can interact with one another to perform the desired functions of the application. Object oriented programming was created to guide the creation of better software, by achieving easier maintenance and reusability.
There are four main principles of Object Oriented Programming: encapsulation, inheritance, polymorphism, and abstraction.
Four Main Principles of OOP
Encapsulation: A desired outcome of organizing code in classes in order to keep things from being mixed with other unrelated bits of code. Encapsulation make it easier to reason about code because of the modularity of code written in object oriented styled classes.
Inheritence: A principle which allows an instance of an object to borrow attributes and methods from its parent class.
Polymorphism: The ability of the class to be dynamic in its use of class methods so that objects with the same parent class can make use of these parent class methods.
Abstraction: A principle that highlights the benefit of hiding complex parts of code from other parts in order to make it easier to reason and make decisions about the code.