sorry ask this nooby question..
but can someone explain the difference between object oriented and procedural programming, in terms that a 10 yr old child can understand:crying:...
or maybe 15 yr old?
help is very much appreciated..
thank you so much...
OOP VS procedural
Started by encio, Apr 06 2010 03:52 AM
11 replies to this topic
#1
Posted 06 April 2010 - 03:52 AM
|
|
|
#2
Posted 06 April 2010 - 04:56 AM
Procedural Programming provides a programmer a means to define precisely each step in the performance of a task. The programmer knows what is to be accomplished and provides through the language step-by-step instructions on how the task is to be done.
Object Orientation uses objects consisting of fields and methods to design programs. It also includes programming techniques like data abstraction, encapsulation, modularity, polymorphism, and inheritance.
Data Abstraction: allows handling data bits in meaningful ways. For example, it is the basic motivation behind datatype. (Datatype meaning int, string, boolean, and other types)
Encapsulation: (Information Hiding) the process of compartmentalizing the elements of an abstraction that constitute its structure and behavior; encapsulation serves to separate the contractual interface of an abstraction and its implementation.
Modularity: a software design technique that increases the extent to which software is composed from separate parts, called modules.
Polymorphism: the ability of one type, A, to appear as and be used like another type, B.
Inheritance: a way to form new classes (instances of which are called objects) using classes that have already been defined.
Comparison of the two:
The focus of procedural programming is to break down a programming task into a collection of variables, data structures and subroutines, whereas in Object-Oriented Programming it is to break down a programming task into objects with each "object" encapsulating its own data and methods (subroutines). The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an "object" operates on its "own" data structure.
Nomenclature varies between the two, although they have much the same semantics:
object-oriented --> procedural
method --> function
object --> module
message --> function call
attribute --> variable
Object Orientation uses objects consisting of fields and methods to design programs. It also includes programming techniques like data abstraction, encapsulation, modularity, polymorphism, and inheritance.
Data Abstraction: allows handling data bits in meaningful ways. For example, it is the basic motivation behind datatype. (Datatype meaning int, string, boolean, and other types)
Encapsulation: (Information Hiding) the process of compartmentalizing the elements of an abstraction that constitute its structure and behavior; encapsulation serves to separate the contractual interface of an abstraction and its implementation.
Modularity: a software design technique that increases the extent to which software is composed from separate parts, called modules.
Polymorphism: the ability of one type, A, to appear as and be used like another type, B.
Inheritance: a way to form new classes (instances of which are called objects) using classes that have already been defined.
Comparison of the two:
The focus of procedural programming is to break down a programming task into a collection of variables, data structures and subroutines, whereas in Object-Oriented Programming it is to break down a programming task into objects with each "object" encapsulating its own data and methods (subroutines). The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an "object" operates on its "own" data structure.
Nomenclature varies between the two, although they have much the same semantics:
object-oriented --> procedural
method --> function
object --> module
message --> function call
attribute --> variable
-CDG10620
Software Developer
Software Developer
#3
Posted 06 April 2010 - 06:28 AM
Object Oriented programming:
Something like that, although it is probably not a good example, it should give you a hint.
Dog dog = new Dog("Pluto", 5); // Pluto is 5 years old.
dog.bark();
dog.eat();
dog.playDead(5000); // 5000 ms.
Procedural programming:char[] dogName = "Pluto"; int dogAge = 5; bark(dogName, dogAge); eat(dogName, dogAge); playDead(dogName, dogAge, 5000);------
Something like that, although it is probably not a good example, it should give you a hint.
#4
Posted 06 April 2010 - 06:57 AM
Procedural programming focuses first on the process to solve a problem, and secondarily on the data that needs to be recorded.
Object oriented programming focuses first on the data to solve the problem, and secondarily on manipulations of that data.
Object oriented programming focuses first on the data to solve the problem, and secondarily on manipulations of that data.
#5
Posted 06 April 2010 - 07:35 AM
what seems to be my problem in understanding these concepts is the language barrier, coz english is not my native language...
your explanation gave me an idea of what it is about, but still it's a bit cloudy to me..
Is it right thing to say that procedural programming concentrates on algorithms or steps, where as object oriented concentrates on the parts or pieces or details?
Can someone give an analogy on how, for example, a HOUSE will be built using procedural compare to OOP?
I'm really really sorry to waste your time, but I really want to understand these concepts.. Unfortunately, there's nothing in my dialect has an explanation on these matters...
Again thank you..
your explanation gave me an idea of what it is about, but still it's a bit cloudy to me..
Is it right thing to say that procedural programming concentrates on algorithms or steps, where as object oriented concentrates on the parts or pieces or details?
Can someone give an analogy on how, for example, a HOUSE will be built using procedural compare to OOP?
I'm really really sorry to waste your time, but I really want to understand these concepts.. Unfortunately, there's nothing in my dialect has an explanation on these matters...
Again thank you..
#6
Posted 06 April 2010 - 12:05 PM
It's the difference between a recipe and pets.
With a recipe, you have step-by-step instructions, and you happen to need ingredients, mixing bowls, etc, to complete them (procedural).
With pets, cats and dogs have different behaviors. Just bring them into the same home and they start interacting (OOP).
With a recipe, you have step-by-step instructions, and you happen to need ingredients, mixing bowls, etc, to complete them (procedural).
With pets, cats and dogs have different behaviors. Just bring them into the same home and they start interacting (OOP).
#7
Posted 06 April 2010 - 05:03 PM
woot!... it's starting to make sense...
thank you soooo much guys for your time...
i will hug you if you are near me:-P
hopefully you can still help me in my future dilemma:)
thx..thx..
thank you soooo much guys for your time...
i will hug you if you are near me:-P
hopefully you can still help me in my future dilemma:)
thx..thx..
#8
Posted 07 April 2010 - 11:27 AM
Hmm..House Analogy.
Procedural Programming: You have a list of tasks to be performed which are performed in order by one super-worker to create the house. The super-worker has access to every method for completing a given task and every piece of information needed can be accessed in that method.
Object-Oriented Programming: You have a number of different 'workers' (types) that have different 'abilities' (methods) and 'attributes' (fields) workers can interact with each other and components of the house to build it. For example, the electrician doesn't know how to lay bricks (whereas in the Procedural example our super-worker would know how to do both these things).
Lol, that probably makes no sense at all but, hell, it was fun to write.
Procedural Programming: You have a list of tasks to be performed which are performed in order by one super-worker to create the house. The super-worker has access to every method for completing a given task and every piece of information needed can be accessed in that method.
Object-Oriented Programming: You have a number of different 'workers' (types) that have different 'abilities' (methods) and 'attributes' (fields) workers can interact with each other and components of the house to build it. For example, the electrician doesn't know how to lay bricks (whereas in the Procedural example our super-worker would know how to do both these things).
Lol, that probably makes no sense at all but, hell, it was fun to write.
#9
Posted 07 April 2010 - 12:17 PM
@semprance .. thx dude!!!
But correct me if I'm wrong... this concept varies on what programming language you are using right? and not by style of your coding?
But correct me if I'm wrong... this concept varies on what programming language you are using right? and not by style of your coding?
#10
Posted 07 April 2010 - 01:57 PM
Indeed it does. For example, Java and C# use the object-oriented approach in nearly all applications. Languages such as BASIC on the other hand go entirely for the procedural approach. And then there are languages like C++ which combine a number of different approaches within one language.
Check out this wikipedia page for more info on programming concepts and styles: Programming paradigm - Wikipedia, the free encyclopedia
Check out this wikipedia page for more info on programming concepts and styles: Programming paradigm - Wikipedia, the free encyclopedia
#11
Posted 08 April 2010 - 07:19 AM
ooohhhhh...
now things are starting to make sense...
at first I thought programming languages were developed to support a certain paradigm... never thought there's such thing as Multi-paradigm programming language...
so i was confused after reading a thread saying something like " OOP is good for long projects and Procedural for short ones"... and then I was like " how can you switch to Procedural if the language you are using supports OOP?????"
and then you guys came and lit up my way:thumbup:
heheeh TY!!
now things are starting to make sense...
at first I thought programming languages were developed to support a certain paradigm... never thought there's such thing as Multi-paradigm programming language...
so i was confused after reading a thread saying something like " OOP is good for long projects and Procedural for short ones"... and then I was like " how can you switch to Procedural if the language you are using supports OOP?????"
and then you guys came and lit up my way:thumbup:
heheeh TY!!
#12
Posted 09 April 2010 - 01:17 AM
No problem :-)


Sign In
Create Account


Back to top









