Jump to content

Procedural vs OOP


TheBrandon

Recommended Posts

no one here is giving us anything to understand when procedural is better.

 

I don't believe anyone ever said it was better.

 

If you use procedural code in large applications (and I mean exclusively) then you clearly have not programmed in any other language than php. Get a general programming book.

 

I'm not sure your in a position to hazard guesses at what languages people here have and haven't used.

 

So... what about the Linux kernel? One of (if not the single biggest) open source projects around.

 

Sadly, I am in a position to guess and to share an opinion and to debate or agree/disagree. Personally I find the whole debate pointless when I doubt you're going to get much work coding procedurally. And if you can't get work because you insist on procedural code (again talking about php here), then what's the point?

 

Every framework and almost every widely distributed php application (like wordpress etc) use OOP. Unless the majority have got it wrong, maybe we should be using procedurally *more*. Maybe the developers made a huge mistake working OOP principles into PHP5.

 

I am required on almost every medium project ($1000+) to submit code samples. Majority of the time I'm clearly told that they will not accept procedural code. I dunno why. Could be that they're blinded by the pro-OO crowd, or it could be they believe procedural simply will not suffice for large codebases. Definitely wasn't like this a few years ago. I have noticed a trend in people wanting projects to be built on popular frameworks (which are all OO). I *assume* this is because it provides a common structure should somebody else come in to further develop.

 

To be honest, it doesn't matter to me. I code however I have to code to get work. If OOP is in demand and procedural is out, then so be it. I'm no hobbyist. I didn't learn php because it's a pretty language though I do love using it :)

Link to comment
Share on other sites

 

Prototyping, small applications, and applications built for pure speed all could have an advantage using procedural over object oriented.

 

Here is an example, since you oh-so-badly want one where oop isn't really worth it... and don't tell me you'd rather do the object oriented version because that is a load of BS.

 

Code: [select]

<?php

echo "Hi there!";

?>

vs.

 

Code: [select]

 

<?php

class speak {

  public function sayHello( ) {

      return "Hi There";

  }

}

$talking = new Speak;

echo $talking->sayHello();

?>

 

 

Are you serious with this, i mean really serious.

 

 

no one here is giving us anything to understand when procedural is better

 

I don't believe anyone ever said it was better.

 

.

 

I am saying it is better.

 

 

 

Common people i know there are not any good arguments why to use procedural but since you insist that procedural has its place than give us examples but be serious not like guy above that posted hello world app. some real life examples where procedural is better than oop except for assembly. Common are you really going to compare assembly to php. Even in assembly people are finding ways to use oop.

 

 

Link to comment
Share on other sites

@Anti-Moronic: Your no hobbyist? Yet are calling $1000 projects medium? It's rare I will take on a freelance job for less than $10000. That being said, these projects aren't done in procedural (not much I do is but that is beside the point).

 

The point I'm trying to make is that allot of people are simply blinded by the OOP paradigm and assume it is now the only way. You think your a good programmer because you use OOP?

 

The other point here is that the OP asking the question obviously has limited experience. For him/her at this point in time procedural is obviously the better option because that is going to get shit done.

 

@HardCoreMore: I'm not sure where assembly came into the argument. Are you proving your own ignorance?

Link to comment
Share on other sites

@Anti-Moronic: Your no hobbyist? Yet are calling $1000 projects medium? It's rare I will take on a freelance job for less than $10000. That being said, these projects aren't done in procedural (not much I do is but that is beside the point).

 

thorpe you're not contributing to the conversation. it's not important how big projects someone take. we are talking about OOP vs. procedural

 

The point I'm trying to make is that allot of people are simply blinded by the OOP paradigm and assume it is now the only way. You think your a good programmer because you use OOP?

 

yes, we that use OOP are best programmers in whole white world. we are so good that we just go around forums and spam people how OOP is great. i mean we are the best men. still not not contributing to the conversation

 

 

The other point here is that the OP asking the question obviously has limited experience. For him/her at this point in time procedural is obviously the better option because that is going to get shit done.

 

it's not matter what will get shit done when question was "what is better OOP vs procedural". he didn't ask "what will get shit done"

still not not contributing to the conversation

 

@HardCoreMore: I'm not sure where assembly came into the argument. Are you proving your own ignorance?

 

well i put it into argument. will you please put some arguments so we can have normal topic here instead of spaming

 

 

 

Link to comment
Share on other sites

thorpe you're not contributing to the conversation. it's not important how big projects someone take. we are talking about OOP vs. procedural

 

It is when someone is trying to prove that they have worked on decent sized projects.

 

yes, we that use OOP are best programmers in whole white world. we are so good that we just go around forums and spam people how OOP is great. i mean we are the best men.

 

That about sums it up.

 

it's not matter what will get shit done when question was "what is better OOP vs procedural". he didn't ask "what will get shit done"

 

The answer to the original question obviously needs to take into account the users abilities.

 

well i put it into argument. will you please put some arguments so we can have normal topic here instead of spaming

 

I'm still not convinced you or your mate are anything but typical OOP fanboys.

Link to comment
Share on other sites

thorpe its you still don't understand. its not important if we are OOP fanboys or not. still not contributing to conversation. lets talk about OOP vs procedural and we may learn something instead poking each other eyes

 

 

it's not matter what will get shit done when question was "what is better OOP vs procedural". he didn't ask "what will get shit done"

 

The answer to the original question obviously needs to take into account the users abilities.

 

well  the users abilities can change. don't you think so?

Link to comment
Share on other sites

lets talk about OOP vs procedural and we may learn something instead poking each other eyes

 

I'm not sure you guys have that ability, that is my entire point.

 

Some of the biggest programming projects still currently being maintained are written almost entirely using procedural code, yet you guys write it off as inferior and state that large projects cannot be done using it.

 

The facts are simple, and ignace stated them in his very first reply.

 

"You can as easily write the application in procedural as you can in OOP, it's all just a matter of preference and opinion."

 

The truth of the matter is you just need to know what you are doing.

Link to comment
Share on other sites

While those projects might gain some benefits from being written using OOP, the point is proven that sometimes you just have to use the best tools for the job, in those cases, the C programming language which does not support OOP. In these cases, the advantages of a fast (and resource friendly) language (using the procedural method) wins over using a slower more resource hungry language just to gain the advantage of OOP.

Link to comment
Share on other sites

Every methodology has advantages and disadvantages. Your role as an (expert) programmer is to know them. Imagine they assigned you to write Mathematica (mathematical software package). Clearly if you used OO or procedural it wouldn't have become the popular software it is today instead it uses functional programming which looks like procedural but has no globals, no dependencies between each processes (functions) which allows to execute each process on a different CPU core which maximizes performance and throughput.

 

Learn and understand OO, procedural, functional, ... and use your judgment as when to apply which. Your client thanks you!

Link to comment
Share on other sites

  • 2 weeks later...

@Anti-Moronic: Your no hobbyist? Yet are calling $1000 projects medium? It's rare I will take on a freelance job for less than $10000. That being said, these projects aren't done in procedural (not much I do is but that is beside the point).

 

The point I'm trying to make is that allot of people are simply blinded by the OOP paradigm and assume it is now the only way. You think your a good programmer because you use OOP?

 

The other point here is that the OP asking the question obviously has limited experience. For him/her at this point in time procedural is obviously the better option because that is going to get shit done.

 

@HardCoreMore: I'm not sure where assembly came into the argument. Are you proving your own ignorance?

 

No, I'm no hobbyist. I take on $1000-5000+. $5000+ being large. I also run a company with 5 other developers who do exactly the same thing. Not due to lack of work, but due to choice. Managing 4 or 5 $5k projects is easy peasy and earns me a LOT of money. Sorry, but I just don't accept procedural code in php and neither do my clients. Get over it.

Link to comment
Share on other sites

thorpe you're not contributing to the conversation. it's not important how big projects someone take. we are talking about OOP vs. procedural

 

It is when someone is trying to prove that they have worked on decent sized projects.

 

yes, we that use OOP are best programmers in whole white world. we are so good that we just go around forums and spam people how OOP is great. i mean we are the best men.

 

That about sums it up.

 

it's not matter what will get shit done when question was "what is better OOP vs procedural". he didn't ask "what will get shit done"

 

The answer to the original question obviously needs to take into account the users abilities.

 

well i put it into argument. will you please put some arguments so we can have normal topic here instead of spaming

 

I'm still not convinced you or your mate are anything but typical OOP fanboys.

 

Wow Thorpe, way to get personal matey! Didn't direct one thing toward you personally. Typical attitude of somebody who isn't mature enough to discuss. Listen, I brought up some of the projects I've worked on because it raises a VERY important point:

 

whether procedural or OOP is better doesn't matter. What matters is what is in demand. That is it. Not hard to understand. On the projects I and my team work on I am yet to find in the last 5 years more than a handful of clients who do NOT specifically require OOP and/or OOP based frameworks to be used to develop php applications.

 

Dunno what else to say. Supply and demand and OOP is in demand.

Link to comment
Share on other sites

Sorry, but I just don't accept procedural code in php and neither do my clients.

 

Technically your project consists 99% out of procedural (PHP + MySQL + Apache + Linux) with a thin layer of OOP (what you wrote). Also, do you know that static functions by definition are procedural code?

 

Don't take this personal we are arguing about your arguments not about you! We only try to explain to you that you should not become too attached to a language or a methodology and that you should experiment with different languages and different methodologies and find the best in each. Evaluate on each new project which methodology will suit the project best and the language unless your client explicitly states a language and a methodology or some other factors prescribe it (eg write a module for a VB.NET driven project).

Link to comment
Share on other sites

  • 2 weeks later...

I have this argument with one of my coworkers quite often.  I'm of the persuasion that object-oriented development is vastly better for the development of applications both big and small.  It is undeniable that almost any application with even a marginal amount of success will grow in both features and functionality.  As those features and functions increase so does the code base.  The benefits of OO development and design are that the data and the methods that operate on those data elements are largely contained in classes.  Procedural code doesn't offer that.  Now, while a single developer writing procedural code may know exactly where he/she placed the functions he/she wants to use on particular data elements, future developers will often grit their teeth and curse their predecessors as they search through scripts for that function they were told "validates an md5 hash against a particular database field."  ::)

 

In addition to containment, additional methods and operation can be extended or overwritten from a parent class to new classes when necessary.  This allows a load of benefits from a greater control on backwards compatibility to the security of functionally sensitive operations.  To do the same thing in procedural code one must either call a series of previous functions and manipulate/store their results in a new function or write new code that performs very similar tasks as older code that adds to the confusion.

 

It's also worth noting that many of PHPs new functionality is also written in OO style.  Take a look at PDO, SimpleXML, DOM, etc.  :)

 

This is not an exhaustive list of the benefits of OO development, merely the tip of the iceberg in my opinion. 

 

P.S. - I know emoticons are ridiculous but I can't stop using them.

Link to comment
Share on other sites

Would be stupid to write anything more than 1 standalone file script as proceedural, you would be making a car out of twigs and leaves.

 

 

Creat eyour objects

 

Engine()

 

Lancher()

 

GuardDog()

 

Memory()

 

Html()

 

Controlers()

 

Modles()

 

Interupts()

 

 

and make them all work together sohow() however you feel, writ ethem however you feel, only you can judge how good its going to be or what style or technique to use.

Machine::add(Engine(),
Lancher(),
GuardDog(),
Memory(),
Html(),
Controlers(),
Modles(),
Interupts()
)->start();

 

 

Link to comment
Share on other sites

Sorry, but I just don't accept procedural code in php and neither do my clients.

 

Technically your project consists 99% out of procedural (PHP + MySQL + Apache + Linux) with a thin layer of OOP (what you wrote). Also, do you know that static functions by definition are procedural code?

 

Don't take this personal we are arguing about your arguments not about you! We only try to explain to you that you should not become too attached to a language or a methodology and that you should experiment with different languages and different methodologies and find the best in each. Evaluate on each new project which methodology will suit the project best and the language unless your client explicitly states a language and a methodology or some other factors prescribe it (eg write a module for a VB.NET driven project).

 

Sorry! I've allowed myself a couple of weeks before I came back to this topic. As you can tell, I have some strong views and I am quite ignorant and stubborn in some regards.

 

First, I'm talking about the overall structure, not the actual source code.

 

My black and white attitude is OOP is better for *most* applications. I rarely find myself in a situation where OOP would not provide a better solution, and that means in terms of an 'expected approach' to maintainability and extendability. Using OOP in the past on codebases of 10k+ lines has saved me a *lot* of money and time during [even design, ] development and maintenance.

 

I don't choose OOP because I think it is 'better' in any sense, I choose it because it is more convenient for *me*. If there were a decent framework built using procedural which outran the other frameworks I would no doubt take a look, and use it. With clients and such, the issue is they don't really know what they need, they just know they want something someone else can work on in the future if I roll down a mountain and die. I'm not against procedural, I'm just a big advocate of OOP.

 

I think this sums up well why OOP exists.

 

http://www.essortment.com/all/objectparadigm_ruqg.htm

 

I didn't realize this was such an endless topic for discussion either. I never really thought about it. I just thought it was a given. Seems I need to open my mind a little more, remember my roots ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.