Object Oriented Programming

This post describes features of object oriented programming .

5/7/20231 min read

Object Oriented Programming is a software design paradigm .It represents real world entities as objects inside software .These objects contain both data and code,for example a real world employee can be represented as employee class.It will contain name ,age, salary ,date of birth as variables and getAge(),getName(),getSalary() as methods to sccess and manipulate these variables.

Object Oriented Programming has various concepts.

1)Abstraction:-It means that only a limited amount of information is visible to the outside world and the essential details are hidden .Thiis is similar to working of a car where a driver is aware how to operate the car,but doesn't know the implementation of the engine .

2)Encapsulation:-It means hiding the variables and methods of the class.This prevents outside methods to not be able to directly access variables and methods of the class.In object oriented programming the variables and methods are packed as a single unit.Encapsulation is implemented by letting only the methods of the class to access the variables of that class.

3)Inheritance:-It allows the child class to acquire the properties of the parent class .

4)Polymorphism:- It allows one method to take multiple forms and perform different functions .Polymorphism can be of two types run-time polymorphism and compile -time polymorphism depending upon the time of resolution of method call to actual method.

Advantages of polymorphism

1)It reduces the amount of code that has to be written ,hence it improves code readability and maintainability.

2)It makes the code reusable .

3)It allows dynamic binding based on the actual class of the object .

Advantages of OOPS

1)Reusability:- multiple child classes can reuse the methods of the parent class.This is possible due to inheritance.

2)Modularity :- Because of modularity we don't have to make changes in the entire code when abug occurs.Modularity is possible due to encapsulates ,which makes the objects self -contained .

3)Security:-Due to encapsulation and abstraction only a limited amount of data is visible to the outside world ,which makes the application more secure .

4)Flexibility due to polymorphism:-Pol