Â
Object Oriented Programming (OOP) is a programming paradigm that uses classes and objects to organise code. Every developer has used at some point in their career. It is taught as the standard way to code in most computer courses across India.
Â
It simplifies software development and maintenance by providing some concepts:
Â
Object-oriented programming languages include Java, C++, Python, and JavaScript, among others.
Let's dive into each of these in a little more details.
Â
Â
1. OBJECT
An object is any entity that has a state and behavior. For example, a chair, pen, table, keyboard, bicycle, etc. It could be physical or logical in nature. An instance of a class can be defined as an Object. An object contains an address and occupies some memory space.
The only thing important is the type of message that is accepted and the type of response that the objects provide.
Â
Â
2. CLASS
The term "class" refers to a collection of objects. It's a logical entity. A class can alternatively be defined as a blueprint from which an individual object can be created. Class doesn't use much space.
Â
Â
Â
3. INHERITANCE
Inheritance occurs when one object inherits all of the characteristics and behaviors of a parent object. It allows code reusability. It's used to achieve polymorphism at runtime.
Â
Â
4. POLYMORPHISM
Polymorphism occurs when a single task is performed in multiple ways. For example, to convince a consumer in a different way, to draw something, like a triangle, rectangle, etc.
To create polymorphism in Java, we use method overloading and method overriding.
Â
Â
5. ABSTRACTION
Abstraction is the process of hiding internal features while displaying functionality. For example, we don't know the internal processes of a phone call.
To achieve abstraction in Java, we use abstract class and interface.
Â
Â
Â
6. ENCAPSULATION
Encapsulation is the process of binding (or wrapping) code and data into a single unit. For example, a capsule is wrapped in various medicines.
A java class is an example of encapsulation.
That's all for now. Until next time.