Object-oriented programming paradigms
The key motivational factor in the invention of an object-oriented approach is to remove some of the faults in the procedural approach.
The OOP considers the data as an important element in the development of the program and does not allow it to flow independently around the system.
This connects the data more closely to the tasks it runs on, and prevents it from accidental amendments from external functions. OOP allows the decomposition of a problem in many units called objects and then creates data and functions around these objects.
The object's data can only be accessed with the functions associated with that object. However, the tasks of an object can reach the work of other objects.
Some striking features of object oriented programming are:
- 1. Instead of processing the emphasis is on data.
- 2. The programs are divided into objects known as objects.
- 3. Data structures are designed in such a way that they portray objects.
- 4. The functions that run on the data of an object are tied together in the data structure.
- 5. Data is hidden and can not be accessed by external functions.
- 6. Communicate the objects through actions with each other.
- 7. New data and tasks can be easily added whenever needed.
- 8. The program adheres to the bottom-up approach in design.
|Organization of data and functions in OOP|
Object oriented programming is the most recent concept among programming paradigms and still different things mean for different people. It is important to keep the work definition of object-oriented programming before moving ahead. We define "object-oriented programming as an approach that provides a way of modularising programs by creating split memory fields for demand and such tasks, which are used as templates for making copies of such modules on demand can go." Thus, an object is considered to be a partitioned area of computer memory, which stores the set of data and operations that can access that data. Since memory splits are free, the object can be used in various programs without any modifications.
Basic concepts of object-oriented programming.
It is necessary to understand some concepts used extensively in object-oriented programming. Contains.
- 1. Objects
- 2. Classes
- 3. Data abstraction and encapsulation
- 4. Inheritance
- 5. Polymorphism
- 6. Overloading
We will discuss these concepts in some concepts in this section.
This is the core unit of object-oriented programming. The data and functions running on the data are bundled in the form of a unit called both objects.
When you go to define the class, you define blueprints for an object. And it does not really define any data, but it defines what the name of the class is, that is, what will be an object of the class and which operations can be done on such an object.
3. Data Abstraction and Encapsulation.
Data abstraction, providing only the necessary information to the outside world, and to hide the essential information in the program, without giving details, to hide their background details.
For example, the database system hides certain details, how the data is stored and created and maintained. Similarly, C ++ classes provide different methods to the outside world without giving them internal details about those methods and data.
Encapsulation is keeping data and those functions, which work on that data in the same place. While working with procedural languages, it is not always clear which functions work, which have variables, but object-oriented programming provides a framework to keep data and related functions together in the same object .
One of the most useful aspects of object oriented programming is code reusability. As its name suggests, the heritage is the process of creating a new class from the existing class, which is known as the base class from the current class, the new class is called derivative class.
This is a very important concept of object-oriented programming, because this feature helps reduce the code size.
The ability to use operators or functions in different ways in other words, giving operators or tasks to different meanings or functions, is called polymorphism. And poly refers to many. It is a single function or operator that works differently on the usage called polymorphism.
The concept of overloading is also a branch of polymorphism. When the external operator or function is created to operate on the new data type, it is overloaded.