Objet Orient Programming(OOP)

Objet Orient Programming(OOP)

Postby TechGuy » Wed Jun 17, 2009 2:53 am

In the current era of computer, Object Oriented Programming has a lot of impact on computer languages. Experience says, Object Oriented Programming makes the code data friendly, there by increasing data security and data flow. We have seen in C computer language that, the code is written in a procedure priority basis. The meaning of this is programmer always try to concentrate on the flow of the program rather than the data. Although everyone knows, that the code is written for data. But in Object Oriented Programming Languages like Java, the coder have to prioritize the data over code during programming.

Let us try to understand few Jargon in OOP and how OOP( Object Oriented Programming helps in achieving all the above features.

1> Data Abstraction:

Abstraction represents the things look like simple. For example think about your computer. Do you know there are thousands of circuits, components are there inside the computer and millions of transistors inside the tiny processor. But when we use a computer we nevr think about all those details. That is what abstraction.

Let us take one programmatic approach to explain this term. When you will learn Java you will find there may be various well defined components from various vendors. You may be developing a big project by buying some components from other vendors. For example, If your project is dealing with Employee system, you may like to buy a component like PayRoll from a wel experienced Vendor in that field. Here you can see we are not at all interested in the internal work of the Pay Roll system. Just we want to give some input and we get some desired output from the system for our project. This is what Data Abstraction.

2> Encapsulation :
This one of the most important and mandatory terminology in OOP. This helps in keeping our data safe from outside world. It keeps data and code ina single unit there by restricting the access from outside code.

Take the example of C programming. If you are creating a small program like " Hello World!" then you can not understand the pain of managing the data throughout the program. Believe me if you are creating a program consisting of several methods/functions and your code is growing like anything, then you will find it very difficult to manage the data. Unknowingly you may modify a data in the course of the programming.

But in OOP, this is not possible. Because eery methods/function, every variable has its predefined scope, beyond that the variable/functions loose its presence. So there is minimal question that you will alter some data unknowingly. It is achieved through your encapsulation. For example, all the variables and methods in Java are bind together in a single class.

3>Inheritance
Inheritance is one of the important features in any of the programming languages. Inheritance encourage the reusability features, there by decreasing coding for the programmer. Inheritance is nothing but, aqua ring the properties of object of a different class in our current class with out even coding the same.

Let us take an live example.
Think about a vehicle. It can be a two wheeler or four wheeler or multiple wheeler. In two wheeler we can have different types of bikes, scooter and moped etc. In four wheeler version of vehicles, there can be school bus, sedan, minivan etc and again we can classify the bikes into different make and so on. The meaning of saying all these is all the bikes cars of all makes inherit the features of parent vehicle.

To be continued...
TechGuy
 
Posts: 3
Joined: Wed Jun 17, 2009 2:16 am

Return to Core Java

Who is online

Users browsing this forum: No registered users and 1 guest

cron