Monday 14 October 2013

Object Oriented Programming

Usually , for us computer scientists programs are organized around the idea of action and logic but Object Oriented Programming is a programming model that organizes them around objects and data.
How is that possible ?
Well , OOP allows decomposition of a problem into a number of entities called Object and then builds data and function around these objects and these objects can only be accessed by the functions associated with it. A class however is a blueprint for an object that contains variables for storing data and functions to performing operations on these data.
There are three main concepts to the understanding of the concept of object oriented programming :
1) Encapsulation
2) Abstraction
3) Inheritance
We will explain briefly each concept putting in mind that all languages that support OOP will support these three concepts.
 Encapsulation:

Wrapping up data member and method together into a single unit (e.g..class)  is called Encapsulation.
Encapsulation is like enclosing in a capsule. That is enclosing the related operations and data related to an object into that object. Encapsulation is hiding internal details of the object i.e it doesn't care how the object does something as long as it does it !!
Abstraction:

Abstraction lets you focus on what the object does instead of how it does it. It is the process of hiding the working style of an object, and showing the information of an object in an understandable manner.
Inheritance:
Inheritance is the process of reusing objects and its methods. Its how classes can acquire property from other "parent" classes.

Summary 
Unlike Structured Programming Languages, in which programs are designed with collections of functions that are called in different parts of the program, more like a script or job list , OOP programs are designed with the concept of objects, where each object contains its own set of variables and functions.



No comments:

Post a Comment