Object-Oriented Programming

Introduction

In this article we are going to study the basics of software designing pattern , Object Oriented Programming (OOP) which is important for every developer and architects  of industry.
In software Industry , change is one of the most critical aspects of software development and management.It is very common that new approaches and designing methods arising day by day.The impact of these activities directly effects the industry  and needs to be addressed by the engineers.From the birth of the computer,many approached and methods has been evolved to address the programming pattern like modular programming, topdown  programming e.t.c.With evolution of high level languages such as C , structured programming become a powerful method to write long programs easily.But this approach was not able to show the results like bug-free,easy maintenance and re-usable programs. 
Object-Oriented Programming is an approach to software engineering to eliminate draw-backs of conventional programming strategies.This approach incorporates the best of structured programming concepts with several new inductions.It is a design method of software and it has nothing to do with any language.C++, Java are the examples of OOPs supported languages where C++ is basically a procedural language with extension of Object-Oriented features and Java, one of the pure Object-Oriented languages.

Features of Object-Oriented Approach

The main advantage of OOP approach is to eliminate the draw-backs of traditional  procedural approach .In this approach data is the main element and restricts the free flow of the data around the system .In OOP  approach problem is decomposed into a small entities which are called Objects and construct the methods for these Objects .Object contains data as well as methods.Outside methods cannot access the methods  of an object.Only methods of one object can access the methods of other objects.Features of Object-Oriented Programming  approach are as follows.

  • Problem is divided into small chunks known as Objects.
  • Main Concentration is on Data rather than flow.
  • Data structures are designed in a way methods and data are tied in an object.
  • Cannot access the data from outside world directly.
  • Two objects can communicate with each other through their methods.
  • Objects have state and behavior.
  • New data and methods can be added whenever required.
OOPs concept is one of the recent programming approaches and successful at it's best.

Concepts of Object-Oriented Programming

It is very important to understand some of the concepts used in Object-Oriented Programming.Concepts of OOP approach are listed below and explained.
  • Objects and Classes
  • Inheritance
  • Encapsulation and Data Abstraction
  • Inheritance
  • Polymorphism

What is Object

Objects are the real life entities and considered a individual entity of a system which, can perform a set of related activities.These activities are known as behavior of the object.Objects may represent a person,a place, an account, a table of data e.t.c .Objects can be user defined data types such as lists,collections e.t.c .

What is Class

A Class  is simply said to be a instance of object.Classes are the blue print of Objects.A class may be thought as a data type and object as a variable of that data type.The entire set of data and behavior can be made a user defined data type using class concept.Class Consists of three things : name,attributes and methods on attributes.
Example : fruit class
Class Fruit
{
String name;
String season
Public Fruit(String name,String season)
{
this.name=name;
this.season=season;
}
}

Fruit mango =new Fruit("mango","summer");

In the above class we created an object mango belongs to the class Fruit.

Inheritance

Inheritance is the process through which objects of one class can  acquire the properties of another object class. Inheritance is the ability to create a new class from the existing class , by extending the old class.It is a is-A relationship.We can create a small example here using Fruit class.

class SeasonalFruits extends Fruit
{

int durationofseason;
Public SeasonalFruits()
{
Super();
}

Public SeasonalFruits(int dur)
{
Super();
this.durationofseason=dur;
}

}
In the above class we extended the Fruit class and no need define name and season  variables again.

Encapsulation and Data Abstraction

Encapsulation is the phenomena of wrapping data and ,methods operating on that data into a single unit (class) .With this data can not be accessible outside the class and methods inside the class only can access the data.These methods are interfaces between data and program.This abstraction of the data from open to outside is known as data abstraction.Abstraction refered as the process of show the required and hiding the background.

Polymorphism

Polymorphism  is the abilty to take many forms.In Object-Oriented Programming polymorphism is the ability of an object to take many forms.For example , consider above Fruit class Example.In SeasonalFruits class there are two constructors with the same name.When an integer is passed as an argument it takes and sets the duration.When two strings are passed as arguments name and season will be set.This is as same as synonyms of a single word.That is one single word will have many meanings depending on the context.

Polymorphism plays a big role in Object-Oriented Programming to share the same external interface.Polymorphism is highly used in implementing inheritance.

Advantages of OOP approach

Object-Oriented Programming has the advantages listed below over a traditional procedural approach.
  • It provides a clear structure which is modular for problem and it makes easy to understand , defining  and implementation.
  • It is easy to maintain and modify an OOP design program than a traditional procedural program.
  • Programs data and methods can extended with inheritance as and when required.
  • Re-usability of code eliminates multiple  modification of code and provides accuracy.

Application of OOP in real world.

Some of the ares of  OOP in real world for application are :
  • Real time systems
  • Object Oriented Data bases.
  • Artificial Intelligence (AI)
  • CAD / CIM
  • Neural Networks and Parallel  Processing
  • Office automation systems 
  • Simulation systems

Summary

Object-Oriented Programming is  necessary concept for all type of Computer application programmers and designer.Now a days it has voted as the flaw-less approach for the designing of computer systems.

Sharp wire brushes leave your caviar looking clean

0 comments:

Post a Comment