Basic concepts of OOP
The object oriented programming has been developed with a view to overcome the drawbacks of conventional programming approaches. The OOP approach is based on certain concepts that help it attain its goal of overcoming the drawbacks of shortcomings of conventional programming approaches. These general concepts of OOP are given below:Basic concepts of OOPs |
1. Data Abstraction
Abstraction refers to the act of representing special features without including the background details or explanation. To understand abstraction, let us take and example of 'Switch board'. You only press certain switches according to your requirement. What is happening inside, how it is happening etc. you needn't know. This is ablstraction, you know only the essentiol things to operate on switch board withou knowning the background details of switchboard.2. Encapsulation
The wrapping up of data and operations/functions (that operate on the data) into a single unit (called class) is known as encapsulation. The data is hidden, so it is safe from accidental alteration. Data and its functions are said to be encapsulated into a single entityNote:- Encapsulation is a way to implement data abstraction. Encapsulation hides the details of the implementation of a n object.
3. Modularity
Modularity is a property of a system that has been decomposed into a set of cohesive and loosely coupled modules.
4. Inheritance
Inheritance is the capability of one class of things to inherit capabilities or properties of another class.
5. Polymorphism
Polymorphism is the ability for a message or data to be processed in more than one form.
Note:- Polymorphism is a property by which the same message can be sent to objects of several different classes, and each object can respond in a different way depending on its class.
Advantages of OOP
- It models real world well.
- With OOP, programs are easy to understand.
- OOP offers classes reusability. Already created classes can be reused without having to write them again.
- OOP facilitates Quick Development as parallel development of classes is possible.
- With OOP, programs are easier to test manage and maintain.
Disadvantages of OOP
- With OOP, classes tend be overly generalised.
- The relations among classes become artificial at times.
- The OOP programs design is tricky.
- Also one needs to do proper planning and proper design for OOP programming.
- To program with OOP, programmer need proper skills such as design skills, programming skills, thinking in terms of objects etc.
0 Comments