answersLogoWhite

0

Object oriented programming is a design paradigm supported by the languages compiler where aspects of the program are thought of as objects. The code (i.e. functions) and variables required by those methods are grouped together into objects. The object exposes methods to the programmer so the object can be manipulated. There are more advanced aspects of object oriented programming such as polymorphism and inheritance that allow more high level and abstract usage of objects.

Function oriented programming treats functions and variables separately. Functions are used like machines; they take in variables, manipulate, and return them. The variables and functions required to accomplish a task aren't grouped together as in object oriented programming.



For a large project object orientated programming is more flexible and easier to understand. Small, very specific tasks, can some times be best accomplished with straight forward function oriented programming.

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
More answers

Traditional programming techniques focus on structures and separate functions that perform operations on those structures. Object-oriented programming treats the properties of a structure and possible operations on a structure as a single unit, called an object.

Thus the principal difference is the transitivity of the action: in traditional programming, the program performs operations on data, while in object-oriented programming, the program instructs objects to perform actions that in turn perform operations on data. OOP therefore introduces an additional level of abstraction over traditional programming techniques.

User Avatar

Wiki User

15y ago
User Avatar

Object oriented design focuses on "objects" - conceptual entities which have a number of attributes and methods. Function oriented design focuses on functions which operate on data and maintain a system state.

For example, under object oriented programming, you have a square object. You tell the square object what the length of its sides are, where it is located, ask it what the area is, then ask it what the circumference is and then draw the square:

square.setPosition(0,5);

square.setSide(10);

area = square.getArea();

circ = square.getCircumference();

square.draw();

Under function oriented programming, you have a function which determines the area of a given square:

xpos = 0;

ypos = 5;

side = 10;

area = computeAreaOfSquare(side);

circ = computerCircumferenceOfSquare(side);

drawSquare(side, xpos, ypos);

You will notice that both function oriented programming and object oriented programming paradigms encapsulate (or hide) the algorithms which are used. In both cases, we do not know how the square's area/circumference is computed, nor do we know how the square will be drawn. In the case of the drawing, the square could be printed on the console, drawn inside of video memory on your GPU or printed out on a printer. As the user, we do not need to know how to do any of this, and can just let the drawing function do what it was designed to do.

However, only object oriented programming encapsulates data/the system state. Under object oriented programming, the object can hide the system state from the user and guarantee that the square object keeps a legal state.

Under functional programming, the system state is NOT encapsulated, and can be modified outside of the functions. This is bad, because the system state might be modified in a way that the function can not handle properly.

User Avatar

Wiki User

14y ago
User Avatar

None.

They refer to the same paradigm in programming.

User Avatar

Wiki User

15y ago
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between traditional programming and object oriented programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp