Object oriented programming | Abstraction | Encapsulation | Modularity | Inheritance | Polymorphism
Object Oriented Programming |
Object Oriented Programming | Object oriented programming is modern day programming paradigm. it is generally common in all programming languages Weather it is Python , C++ and so on . It can be applicable in all of them.This is a modern approach of programming Paradigm. The traditional approach i.e.. Procedural Programming Paradigm mainly focus on doing tasks Rather the Objects.
Basic Concept of Object Oriented programming
The object Oriented programming has been develop with a view to overcome the drawbacks of conventional programming approaches. The oop approach is based on some certain concepts. That Helps in attaining Goal of overcoming of conventional programming Approaches.The general concepts are :
- Data Abstraction
- Data Encapsulation
- Modularity
- Inheritance
- Polymorphism
Data Abstraction :- Abstraction refers to the act of representing Essential features without including Background Details. Background details or Explanations are hidden.
Let us understand by an example
While Driving a Car , you can only access some important Features such as Breaks , Accelerator , gear of a car ,etc.But we can't access the other Things That we not not need like Main Engine ,etc.This is how Abstraction implements.
Data Encapsulation :- Encapsulation is combining of data and the function associated with data in single unit . In Most of the languages, such as c++, It is called class. It keeps the data safe from any External Interference and Misuse.
Let us understand it by an example
While using a computer's CPU ,it consists of many parts such as Motherboard , Hard disc drive(HDD),etc It is Encapsulated in one cabinet covering these parts.This is how Encapsulation Implements.
Abstraction and Encapsulation is an complementary concepts. Encapsulation is way to Implement Data Abstraction .
Modularity :- Modularity is the property of a system that has been Decomposed into set of Cohesive and Loosely coupled Modules. A Modules is Separate Unit itself . It can be compiled separately Though it has connections with other Modules.
Advantages of using Modularity :
Data Encapsulation :- Encapsulation is combining of data and the function associated with data in single unit . In Most of the languages, such as c++, It is called class. It keeps the data safe from any External Interference and Misuse.
Let us understand it by an example
While using a computer's CPU ,it consists of many parts such as Motherboard , Hard disc drive(HDD),etc It is Encapsulated in one cabinet covering these parts.This is how Encapsulation Implements.
Abstraction and Encapsulation is an complementary concepts. Encapsulation is way to Implement Data Abstraction .
Modularity :- Modularity is the property of a system that has been Decomposed into set of Cohesive and Loosely coupled Modules. A Modules is Separate Unit itself . It can be compiled separately Though it has connections with other Modules.
Advantages of using Modularity :
- It Reduces the Complexities of Program to Some Degree
- It creates the Number of well-Defined, Documented Boundaries Within the Program.
Let us Understand it by an Example :
You Must have seen the Music System in Parties etc.That Music System Includes CD Player, Record Player ,Tuner ,etc Which are a complete unit in Itself. But Still They are Only The part of a Music System.This is Modularity. Similarly, A program can also be divided into Small Units, called Modules. Each Modules are a Complete Units in Itself. But They Coordinately work To Archive a Single goal i.e.. Music.
Inheritance :- Inheritance is a capability of one class of Things to Derive Properties and Capability of some other Class.
Let us understand by an Example
We are the humans. we inherit the properties of class 'Humans' ,properties such as ability to sleep, Eat, Breath , drink,etc. But thee class human inherits from class 'Mammals' and class 'Mammals' again inherits Some properties of class 'Animals'.
Polymorphism :-Polymorphism is the Ability for a Message or Data to be Processed in more than One Form . It is a key to Power a Object Oriented Languages. It is so Important That Languages that don't support polymorphism cannot advertise themselves as OO Languages.
let us understand by an Real life Example
God has gave us a mouth having polymorphic capabilities. if we made a function of 'Consumefrommouth' (Consume From Mouth) it can behave differently on the basis of input given by you. if you input food , The Function has extra logic of using teeth to grind the food, In other case you give input of milk, The function will use the logic of using lips in pout shaped lips instead of using a teeth .
Comments
Post a Comment