A type of programming in whichprogrammers define not only the data type of adata structure, but also the types of operations ( functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another.
The programming challenge was seen as how to write the logic, not how to define the data. Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them. Examples of objects range from human beings (described by name, address, and so forth) to buildings and floors (whose properties can be described and managed) down to the little widgets on your computer desktop (such as buttons and scroll bars).
Ø There are some fundamental concepts of OO Language which a language has to follow to be a truly OO language.
- ENCAPSULATION
- POLYMORPHISM
- INHERITANCE
- OBJECT
- CLASS
- ABSTRACTION
- DATA HIDING / INFORMATION HIDING
- OBJECT
* Encapsulation
Encapsulation is a technique for minimizing interdependencies among separately-written modules by defining strict external interfaces. The external interface of a module serves as a contract between the module and its clients, and thus between the designer of the module and other designers. ... A module is encapsulated if clients are restricted by the definition of the programming language to access the module only via its defined external interface. ("Encapsulation and Inheritance in Object-Oriented Programming Languages" : OOPSLA 86 proceedings)
Every object has a well-defined interface that specifies the behavior of the object in a manner that is independent of its implementation. This interface defines the collection of services that can be invoked by other objects. The implementation of an object describes how to carry out its services. This includes information private to the object, accessible to other objects only if services exist to provide such access. Similarly, the algorithms that implement services are private to the object. No other object can rely on how another object implements its services. This ability of objects to hide internal structure, thereby defining services independent of implementation, is called encapsulation.
* Polymorphism
Identical (identically-named) operations can behave differently in different contexts. The operations that can be performed on an object make up its interface. They enable you to address operations with the same name in different objects.
* Inheritance
You can use an existing type to derive a new type. Derived types inherit the data and operations of the super-type. However, they can overwrite existing operations or add new ones.
* Objects
Object represents real world entity into a program. for example an employee which is real world entity we can make an object of it and then utilize it in a program with its behaviors and actions.
Some other common definitions
1. Object is an instance of a class.
2. Object is a variable of user defined type / abstract data type.
* Class
Class represent template for an object. It actually contains data and their behavior / methods in it and for utilization of it we need to create an object of that particular class. we can create n number of object with one class.
Some other common definitions
1. A collection of data and code to handle that data.
2. Class is a user defined type / abstract data type.
3. Class defines basic layout and functionality of an object.
* Abstraction
To implement real world entity into program. Class uses the concept of abstraction.
Some other common definitions
1. Abstraction is a process of mimicking a behavior.
2. Simplifying complex reality by modeling classes appropriate to problem.
3. Abstraction is a process that involves identifying the crucial behavior of an object and eliminating irrelevant and tedious details.
* Data Hiding / Information Hiding
As encapsulation bind data and methods together, data hiding restrict sensitive data accessing to the system. It is also achieved by using access modifiers i.e. Private, Protected and Public.
In Figure 1 you can see in class Employee that there are notations minus(-) and Plus(+) they represents access modifier, minus sign restrict access outside the class and plus sign gives access outside the class.
Done By:
Ahmad Osta
References: