oriented programming (OOP)
Encapsulation
Abstraction
Inheritance
Polymorphism
Encapsulation: Bundling Data and
Functions Together
Encapsulation is the mechanism of wrapping data
(variables) and functions (methods) that operate on that data
within a single unit, typically a class in object-oriented
programming languages.
Benefits
1. Data hiding: Encapsulation allows developers to hide the
implementation details of a class from the outside world,
exposing only what is necessary. This helps to prevent
unintentional modification of data and ensures that the
class's internal state remains consistent.
2. Code organization: By bundling related data and
functions together, encapsulation makes code more
organized, easier to understand, and simpler to modify.
, 3. Reusability: Encapsulated classes can be easily reused in
different parts of an application or even in other
applications, promoting modular and maintainable code.
Abstraction: Simplifying Complex
Systems
Abstraction is a fundamental concept in computer science
that helps simplify complex systems. It involves reducing the
complexity of a system by modeling only the necessary details
and ignoring the irrelevant ones. This is a note about
Abstraction:
What is Abstraction?
Abstraction is the process of modeling only the essential
details of a system while ignoring the irrelevant ones
It is used to reduce the complexity of a system by hiding
the implementation details from the user
Abstraction helps to create simple, intuitive interfaces
that are easy to use and understand
Benefits of Abstraction
Simplicity: Abstraction reduces the complexity of a
system by allowing the user to interact with a simplified
interface
Modularity: Abstraction promotes modularity by
allowing the implementation details of a system to be
hidden from the user