Subject: Computer Science
There were numerous flaws encountered in the procedural programming. To eliminate such flaws, Object Oriented Programming (OOP) evolved. OOP treats data as a critical element in the program development and does not allow to flow freely around the system. It ties data closely with the functions and protects from accidental modification of data. The data and objects can be accessed within the functions. In OOP, every object is treated differently.
Fig: Object Oriented Programming (OOP)
Characteristics of object Oriented Programming
The major characteristics of Object Oriented Programming are:
Features of Object-Oriented Programming
Although, OOP has many features, some of the important features a programmer need to understand are as follows:
Object Oriented is a term which is interpreted differently by different people. An object is an entity with features. In OOP, we frequently discuss the particular features or characteristics of an object. While programming, we should understand the fundamental concept of an object. It has the following basic general concepts.
Objects are the basic run-time entities in an object-oriented system. An object may represent a person, a place, a bank account, a table of data or any item that the program must handle. They may also represent user-defined data such as vectors, time and lists.
Programming problem is analyzed in terms of objects and the nature of communication between them. Program objects should be chosen such that they match closely with the real world objects.
Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other’s data or code.
We know that objects contain data and code to manipulate the data. The entire set of data and code of an object can be made a user-defined data type with the help of a class. In fact, objects are variable type class. Once the class has been defined, we can create any number of objects belonging to that class.
Each object is associated with the data of the type class with which they are created. A class is thus, a collection of objects of similar type. For example, robin, parrot, and sparrow are members of the class bird. Classes are user-defined data types and behave like the built-in types of programming language.
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to the outside world and only those functions which are wrapped in the class can access it. The function provides the interface between the object’s data and the program. This insulation of the data from direct access by the program is called data hiding.
Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and cost, and functions to operate on these attributes.
They encapsulate all the essential properties of the objects that are to be created. Since the classes use the concept of data abstraction, they are known as Abstract Data Type (ADT).
Inheritance is the process by which objects of one class acquire the properties of objects of another class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird which is again a part of the class bird.
The principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived.
In OOP, the concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving an add additional features to an existing class without modifying it.
This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes.
Polymorphism is another important OOP concept. Polymorphism means the ability to take more than one form. For example, an operation may exhibit different behavior in different instances. The behavior depends on the types of data used in the operation. For example, consider the strings, then the operation would produce a third string by concatenation. (Having Different Structures)
Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run-time. It is associated with polymorphism and inheritance.
A function call associated with a polymorphic reference depends on the dynamic type of data reference. Consider the procedure “draw”. By inheritance, every object like Box, Triangle Object, and Circle object will have this procedure.
An object-oriented program consists of a set of objects that communicate with each other. The process of programming is an object-oriented language. therefore, It involves the following basic steps.
Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that model or simulate their real-world counterparts.
A message for an object is a request for execution of a procedure, the desired result. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent.
OOP has become one of the powerful programming languages these days. OOP helps to develop user interfaces.It's very user-friendly. Many windowing systems have been developed using OOP techniques. Real business systems are often affected by OOP applications. The most common areas of OOP application are:
Using the concept of OOP, modern movie editing software, engineering software, web design software, e-commerce managing software, etc. have been flourishing these days.
Khanal, R.C. Khanal, R.C. Computer Concept for XII. Pashupatigriha Marga, Thapathali, Kathmandu, Nepal: Ekta Books Distributors Pvt. Ltd., 2010.287-290.
© 2019-20 Kullabs. All Rights Reserved.