Introduction
An object-oriented programming was developed due to limitations found in the earlier approaches of programming .
What is object oriented programming (OOP)?
Object oriented programming supports the concept of classes and objects.
Object-oriented programming is a method that gives a way to regulate programs by creating separate memory areas for both data and functions that can be used as models for creating copies of such modules on demand.
An object is said to be a Partitioned area of computer memory that stores data and a set of operations that can access that data. Whereas the memory partitions are separate, the objects possibly be used in a variety of different programs without changes.
Object-oriented programming is a realistic and beneficial methodology that promotes modular design and software reutilization. OOP considers data as a critical element in the program development and completely does not enable it to flow freely around the system. It connects data more accurately to the functions that operate on it, and it also preserves the data from accidental changes from outside functions. Object-oriented programming permits disintegration of problems into a variety of entities called Objects then creates data and functions around these objects.
The basic principle of using objects in programs is simple: the world consists of interacting, Classifiable and identifiable objects, and as a result programs too, and programs can practically be structured in this way. Whereas all software applications assist people living in the real world, so to say that software should imitate the real world as much as possible, both in its functioning and in its basic design. As we can say that object- oriented programming is a natural way to program.
Characteristics of OOP
- Importance is given on data instead of procedure.
- Programs are addressed separately into objects .
- In OOPs data is hidden and it is impossible to access by external functions.
- Objects have the ability to communicate with each other because of functions.
- New data and functions can be conveniently added at any time necessary .
- OOPs follow a bottom- up method in program design.
- Data structures are designed in a way that they characterize the objects.
Features of object-oriented programming languages
Some sort of Features are used widely in object-oriented programming are as follows-
Objects - Objects are the primary run-time entities in object-oriented programming. Objects can be indicative of a person, a place, a bank account, a table of data or any other entity that the program has to handle .
Objects may as well show User-defined data such as vectors, time and lists. Programming difficulty is checked in terms of objects and the sort of communication between them.
As soon as the program is executed, the objects communicate by sending messages to each other.
Classes - A class is a group (collection) of object similar type. As soon as a class has been defined, we can create any desired number of objects associated with that class.
Objects are variables (inconstant) of the type class. Respectively, object is associated with the data of the type class with which they are created and classes are User-defined data types.
Data Abstraction and Encapsulation - The concluding (wrapping) up of data and functions into a single unit (class) is known as encapsulation.
Data encapsulation is the most amazing feature of a class. The data is not accessible to outside of the world, and only those functions which are concluded in the Class can access it. This segregation of data from direct access by the program is called data hiding and information hiding.
Abstraction relates the action of portraying essential and important Features of an object without involving the background details and explanation. Classes use the principle of abstraction and are defined as a list of abstract attributes, for example , weight , size and cost, and function to operate on these attributes.
The attributes are sometimes referred to as data members, due to it containing information. Functions that are managed on this data are occasionally called methods and member functions.
Inheritance - Inheritance is the approach by which objects of one class obtain the Features of another class. Inheritance supports the theory of hierarchical classification. The principle of Inheritance allows the idea of reusability. This implies that we can add additional Features to an existing class without changing it.
Polymorphism - Polymorphism means the capability to take more than one form for instance 'one name, multiple forms'. In OOP a function can have different behaviors in different instances. Principle of polymorphism is executed using overloaded functions and operators.
Dynamic Binding - Dynamic binding means to the Combining of a procedure call to the code to be executed in response to the call. Dynamic binding is also named as late binding means that the code connected with a given procedure call is not known until the time of the call at run-time.
Message passing - OOP composed of a set of objects that communicate with each other. The idea of message Passing be a little easier to talk about building systems that directly model or imitate their real-world counterparts.
Reusability - In object-oriented programming once a class has been written, created and debugged, class can be distributed to other programs for use, this concept is called reusability. The concept of inheritance gives the thought of reusability .
Need Of object oriented programming
In procedural languages, such as C, PASCAL, FORTRAN and other languages, the statement commands the computer to do something, especially, get some input and then process and display that output to the user.
Over here, programs are a list of instructions.
For very limited programs, there is no reason to organize principle, but when programs turn major, an individual list of instructions becomes massive. That is why, function was elected to make programs more understandable. A procedural program is considered separately functions and each function has a straightforward objective.
The splitting concept of a program into function could be expanded by grouping a number of functions mutually into a major entity called a module.
As programs become more Complex and larger, even the structured programming manner starts to show signals and strain. The project is too complex, the schedule slips and complexity hikes. After examining the reason for these failures shows that there are some weaknesses in the procedural programming approach. Regardless of how efficient structured programming methods are implemented, major programs become extremely Complex.
The essential idea behind the object-oriented languages is to integrate into a single unit both data and functions that operate on that data. It is called an object. In this context , we cannot access data directly. The data is unseen, so it is free from accidental alterations.
Conclusion
To write exceptional programs, a programmer should have strong control on OOP concepts. Object-oriented programming repeats nearby the concert of objects, classes and so on.