Page 1 of 2
procedural programming
Posted: Thu Aug 31, 2006 5:46 am
by rsmarsha
I heard someone say they were a procedural programmer.
Not sure what this means really. Do they mean (in the case of php), writing the code to do the job, but without using classes and functions?
Posted: Thu Aug 31, 2006 6:08 am
by Jenk
Procedural is scripting - from start to finish in a predefined routine (aka procedure) with little flexibility.
The 'alternative' is Object Oriented programming. Where Objects interact with each other, often dependant upon what input was received dictating which objects interact.
Posted: Thu Aug 31, 2006 6:49 am
by rsmarsha
So if i was to write a file with no functions and classes, just with code down the page in an order to do what was needed. Thats procedural?
Posted: Thu Aug 31, 2006 6:53 am
by jmut
rsmarsha wrote:So if i was to write a file with no functions and classes, just with code down the page in an order to do what was needed. Thats procedural?
well it is more about organization, workflow etc. models and way of thinking.
If you make a class with 20 methods(functions) in it that do all kind of different stuff...this does not make it object programming.
Posted: Thu Aug 31, 2006 6:59 am
by Jenk
rsmarsha wrote:So if i was to write a file with no functions and classes, just with code down the page in an order to do what was needed. Thats procedural?
the no functions/classes bit is irrelevant, but the rest is correct - yes, that is writing a procedure.. hence the term procedural programming

Posted: Thu Aug 31, 2006 7:18 am
by volka
Posted: Thu Aug 31, 2006 9:38 am
by MrPotatoes
procedural is no OOP
Posted: Thu Aug 31, 2006 9:55 am
by AngusL
Procedural programming is one of many programming paradigms. Other notable paradigms are functional programming and object oriented programming.
http://en.wikipedia.org/wiki/Programming_paradigms
Posted: Thu Aug 31, 2006 10:00 am
by timvw
Imho when someone says that you're a 'procedural programmer' in a PHP context it's usually meant as an insult...
Since that someone used the 'procedural' word you might want to ask *him* what he meant with it, because as you already noticed there are a couple of different definitions for the word...
Posted: Fri Sep 01, 2006 1:31 am
by RobertGonzalez
Procedural vs. Object Oriented. Ah, you can almost smell the smoldering piles of ...
In some PHP circles, procedural code is commonly refered to as code that does not use Objects. It uses functions and such, but does not utilize objects for he core programming technique. Bear in mind, just because you use some objects, that does not mean that you are coding in Object Oriented Style.
Object Oriented Programming on the other hand uses classes (objects) for the predominant portion of the code.
There is a lot more to this that just this little example, but it is a fair assumption that if someone says they are a procedural programmer, that means they either choose not to use OOP or they don't know how.
Posted: Fri Sep 01, 2006 3:55 am
by rsmarsha
Ah ok thanks.
I'm starting to learn OOP, well i am trying.
I wrote a simple class to show some mail code, not sure if it's right, maybe i could post it somewhere for you guys to look at? So you can tell me if i'm doing it right?
Not sure where to post it.
Posted: Fri Sep 01, 2006 4:30 am
by Jenk
You smelly procedural programmer!

Posted: Fri Sep 01, 2006 2:03 pm
by feyd
Just so everyone is aware, this is an extremely touchy and volatile subject area. The moderators will lock this thread if it comes anywhere near a flame war. So keep it civil and you'll be allowed to continue talks.
Posted: Fri Sep 01, 2006 3:28 pm
by AngusL
feyd wrote:Just so everyone is aware, this is an extremely touchy and volatile subject area. The moderators will lock this thread if it comes anywhere near a flame war. So keep it civil and you'll be allowed to continue talks.
Hey, I've got a genuine question since I appear to have missed something...
How is being a 'procedural programmer' insulting? My code in PHP is primarily procedural because I'm using it for scripting - and also because I'm more at home in the land of C99. It's just a programming style - admittedly some languages are meant to be used as OOP (can't see SmallTalk being used otherwise...).

I can see people being proponents of one or t'other... but I'd have thought that would be a little naïve given 'the right tool for the job' idea.
Posted: Fri Sep 01, 2006 4:39 pm
by feyd
AngusL wrote:Hey, I've got a genuine question since I appear to have missed something...
How is being a 'procedural programmer' insulting? My code in PHP is primarily procedural because I'm using it for scripting - and also because I'm more at home in the land of C99. It's just a programming style - admittedly some languages are meant to be used as OOP (can't see SmallTalk being used otherwise...).

I can see people being proponents of one or t'other... but I'd have thought that would be a little naïve given 'the right tool for the job' idea.
The policy comes from past issues we've had with certain individuals starting wars over OOP vs Procedural camps of programming. I won't go any further into this line of discussion. If you want to know what's happened, take a look at previous threads of this nature.