Object-Oriented
Programming (OOP)

Object-Oriented
Programming is a programming paradigm that aims to improve code efficiency,
reusability, security, and maintenance by leveraging objects that can contain
data or code
Abstraction
- Hides the implementation details of
some code
- Code becomes accessible and
reusable without requiring implementation details
- Example: Functions, Methods
Encapsulation
- Limits access, as in a capsule, to
certain parts of a piece of code or data
- Each object should control its own
state
- Prevents reused variable names and
reassigned variable values
- Variables and data can be bound to
a class, method, or object
- Example: Public variables, Private
variables
Inheritance
- Allows objects to inherit
properties and methods from another object
- The same thing needs to happen
across different pieces of the same code
- Reduces likelihood of writing
duplicate code, as multiple child classes can inherit common code from the
same parent class
- Cohesion: How related the code components are
Polymorphism
- Code’s ability to take multiple
forms, so it adapts to the type of data its processing
- Child class can inherit a method
from a parent class, but can overwrite the parent class method and assign
it an entirely new set of rules to follow in the child class
- Dynamic Binding: Code associated with a given
function call is determined at the time of the call at run time
- Example: A method or attribute is
defined and inherited from a parent class and modified by a child class