It's a way of programming that uses "objects" and their associated "methods" to accomplish things, instead of data structures and routines. E.g., a printer object might have methods called Print and Eject.
Java and C++ are object oriented languages.
2007-05-31 12:46:44
·
answer #1
·
answered by CinderBlock 5
·
2⤊
0⤋
Before object-oriented programming, computer languages had two basic parts... variables (places to store data) and functions that operate on those languages.
An object combines the variables and the functions that work on them into one unit.
One of the advantages to this is that there is no naming conflict. You could have to different types of objects that both have variables with the same names, and they will be distinct from one another. The same with functions.
To further aid in organization, a newly created object definition may inherit properties from a parent definition, then modify and/or redefine both variables and functions.
I could go on, but we're getting into non-layman territory.
2007-05-31 13:18:47
·
answer #2
·
answered by Anonymous
·
1⤊
0⤋
Very technical question requres technical answers, but you asked Layman's term. Let me try to answer.
In legacy programming were the functions important. While modeling a real world problem only functions were of the interest not the objects these function belong to or property of. Object Oriented Programming allows you to model the real world objects exactly as they are, with their properties and functions. It means that functions and properties are strictly tied to the objects they belong to.
Take a layman's example:
A bulb is red and can be either of two states 'Glow' or 'Dark'. In legacy programming we will not mode the bulb but its functions GetGlow and GetDark. No existance of bulb and its property to be Red. And if we need many bulbs, the same functions will be used for them, even for tubelights, neon signs etc. So no strict association of these function to any object.
In object oriented programming, we create a class (which defines the obeject) Bulb. We will defin its property Color=Red and two functions GetGlow, and GetDark. From this class we will define any number of bulbs; say: b1, b2, b3 and so on. now if we do this:
b1.color=red
b2.color=green
b3.color=blue
the colors will be set for their respective objects (before '.')
and if we write b1.GetGlow, only b1 will glow and so on.
To sum up: In object oriented programming, real objects are modelled as they are. As in reality their associated properties and functions are strictly associated to them, so is in programming.
This is all what I can do for Layman's information. Hope that makes sense
2007-05-31 12:57:26
·
answer #3
·
answered by Akhlaq A 2
·
0⤊
0⤋
OOP is a way of organizing and writing your code so as to encapsulate related algorithms by using a model based upon real world objects.
An object has properties, events and methods which provide controlled access to the encapsulated program code within the object.
A programmer may create a class object which serves as a template. Like a baker using dough to make different types of cookies by changing the dough properties, programmers can use OOP to create templates through which the copies will hold similar but different information.
For example a programmer can write a car racing program and use OOP to make a class object which represents a car on the track. For each car there are similar properties like color, make,model which are different for each car. Methods are used to control or initiate some action like "Start the engine" or "Save Data". An event in a class object is used to signal other parts of the program or object that something has happened. In our car class we could have a "Braking" event fire enery time we called the "Brake" method. This event would be used by other cars in our game program to also activate their "Brake" methods and slow down in response....
Because OOP encapsulates code into these templates (classes) it is simple to copy these objects and put as many cars on the track as we desire. The benefit of OOP is the encpsulation of the working code in these classes helps prevent inadvertant modifications which could cause a problem. OOP also provides a means to help others understand what the program is trying to do with having to get bogged down in the detailed code hidden by the encapsulation.
In my game program I can have a simple line
Car1.StartEngine
You can understand what I as a programmer are trying to accomplish. Without OOP that simple line of code may represent 10's,100's if not more lines of code. Seeing that many lines of code it may not be readily apparent what I am intending to do in the code.
2007-05-31 16:02:26
·
answer #4
·
answered by MarkG 7
·
0⤊
0⤋