Definition of OOPs
- The term Object-Oriented Programming” (OOP) was coined by Alan Kay circa in 1966 or 1967 while he was at grad school.
- Ivan Sutherland’s seminal Sketchpad application was an early inspiration for OOP.
- It was created between 1961 and 1962 and published in his Sketchpad Thesis in 1963
- The Object-Oriented Programming (OOP) is a modern programming paradigms to solve complex problems.
- The term OOP was used by ‘Xerox PARC’ for the first time in its programming language, called Smalltalk referring to the usage of objects as computational units for processing, in mid 1960s.
- The feature of inheritance introduced for the first time in Smalltalk.
- Simula was the first programming language developed in the mid-1960s to support the object-oriented programming paradigm followed by Smalltalk in the mid-1970s that is known to be the first ‘pure’ object-oriented language.
- Eiffel, Java, C++, Object Pascal, Visual Basic, C# etc are the other OOP languages.
Feature of OOPs
There are following features of OOPs which are described below –
- It is the building block of C++, Java etc.
- It is a user defined data type, that holds its own data members(data variables/properties) and member functions(behaviour), which can be accessed directly or indirectly by an object.
- A class can be described as a collection of data members and member functions.
- A class is set of objects that shares a common definition described by data and methods.
- A class is like a blueprint that represents a group of objects which shares some common properties and behaviours.
- A class contains data and functions together in a bundle.
- In other words, class is a collection of similar type of objects.
- A class is an object template.
- A class is defined by the keyword class.
- An Object is an instance of a Class.
- It is most important feature of C++. It makes C++ an Object-Oriented language.
- Normally when a class is defined, no memory is allocated but when an object is created (instantiation) sufficient memory is allocated.
- When a program is executed, the related objects interact by sending messages to one another.
- Each object contains its own data part and common function to manipulate the data.
- Objects can interact with each other without knowing the details of each other’s data or function.
- Every object under a class has the same data format, definition and responds in the same manner to an operation.
- Data abstraction is one of the most essential and important features of object-oriented programming in C++.
- Abstraction is displaying only essential information to the users and hiding the complexity/details.
- Data abstraction displays only essential information about the data to the outside world, hiding the remaining one in the background or implementation.
Data Hiding :
- This is done by declaring data as private and making it accessible only to the class in which it is defined. This concept is called data hiding. In data hiding, the data is hidden inside the class by declaring it as private inside the class. Here function may be public or private.
- When data or functions are defined as private it can be accessed only by the class in which it is defined.
- Restrictions of external access to features/members of a class results in data hiding.
- If the implementation details are not known to the user, it is called information hiding
- Encapsulation is one of the important characteristics of Object Oriented Programming Language.
- The property of C++ which allow wrapping up of data/information and functions into a single unit is called encapsulation.
- Encapsulation is defined as binding the data and the functions that manipulate them together.
- It is considered as the most striking feature of a class.
- Encapsulation also leads to data abstraction or hiding.
- encapsulation also hides the data.
- Technically it is combination of data and related functions together in a bundle.
- The advantages of encapsulation are data hiding, information hiding and implementation independence.(The user‟s interface is not affected by changing the implementation mechanism. A change in the implementation is done easily without affecting the interface. This leads to implementation independence.)
- It is the ability of a message to be displayed in more than one form as per requirements and situation.
- C++ supports two types of polymorphism – operator overloading and function overloading.
- Polymorphism is mainly used in implementing inheritance.
- Inheritance is one of the most important features of Object Oriented Programming.
- It is the capability of a class to derive required properties and characteristics from another class as per requirements is called Inheritance.
- Inheritance supports the concept of “reusability in which we are reusing the fields and methods of the existing class as per requirements multiple times.
- it helps in reducing the code size since the common characteristic is placed separately in base class.
Message Passing :
- As we know that related Objects communicate with one another by sending and receiving message to each other for better coordination and processing management.
- Message passing normally involves specifying the name of the object, the name of the function and the information to be sent.
Advantages/Benefits of OOPs
- OOPs are very closer to the real world phenomena/works.
- Objects in OOPs show both the state (data) and behavior (function) that is very similar to the real world objects/works.
- OOPs are more suitable to handle large & complex projects easily.
- The projects executed using OOP techniques are more reliable.
- It provides higher quality project.
- Abstraction techniques of OOPs are used to hide the unnecessary details and focuses only on the useful relevant part of the problem and solution.
- Encapsulation feature of OOPs helps in concentrating the structure as well as the behaviour of various objects in OOP in a single enclosure.
- The information hiding feature of OOPs is used to hide the information and to allow strictly controlled access to the structure as well as the behaviour of the objects.
- OOPs divide the problems into several objects for solving a particular problem.
- Object oriented systems are easier to upgrade/modify.
- The inheritance and polymorphism feature provide the extensibility of the OOP languages.
- The concepts of OOP also enhance the reusability of the existing code multiple times.
- In OOPs, Software complexity is managed in better way.
Limitation/Demerits of OOPs
- The size of programmes developed with OOP is larger than the procedural approach.
- The programmer should have a proper planning before designing a program using OOP approach hence it is tricky.
- Since oop program is normally larger in size, hence more instruction to be executed, which results a little bit slower execution of programmes.
1,819 total views, 13 views today