Jump to content

when to use procedural vs oop?


jake2891

Recommended Posts

Always do OOP! That's what they taught me in into to Java!!

 

Just kidding. Personally, I always use procedural, but this isn't a right or wrong type question. The one advantage to always doing procedural (besides performance) is that you don't have to spend much time worrying about how you are going to structure everything. Everything is a function. Utility functions take arguments and return a value or error code, 'action' functions just access globals and return the message they want to show up on the page.

 

The important thing is to find a way that works and not get caught up in how some else says you should program. Java is a perfect example of how bad a language gets when you try to do everything through objects, but some people would swear it is the greatest language ever written. It's as much preference as anything.

Link to comment
Share on other sites

Deary me not this again :S

 

Like thorpe said, it's not as black and white as that.

 

Certainly don't take in the opinions of others on this subject apart from that single one. People are blinded, forever trapped in this ridiculous holy war.

 

Do your research on programming in general. In 5 or 10 years maybe you'll *know* when to use one over the other, and what benefits/problems you will encounter for whichever path you take in whatever application you choose.

 

Try to dig up as many Procedural Vs OOP material as you can. Cast away stuff clearly based on opinion and get down to the core of it.

 

Seems to be quite a decent discussion on this page:

 

http://www.linuxjournal.com/content/programmer%E2%80%99s-discussion-procedural-vs-oo

 

..must say, few of those comments try to keep things objective which is refreshing.

Link to comment
Share on other sites

Like it has been said before, it's not so black and white. Ok, now I just feel like a poser for saying that when it's already been said. Here's my personal opinion though. When it's a quick 4, 5 page project, or something that'll take me a couple days and I have no actual intention of expanding upon, I go with procedural. It's just quicker for me to hack up some well thought out procedural code and make it work nicely, after all, I've been procedural for 5 years now.

 

However, when I'm looking at building a huge project that'll take me a month or more, and I know it'll probably need to be altered/added to, I generally look at it from a procedural AND OOP perspective, thinking which would be easier in the long run. Can I make a framework as comprehensive, flexible, easy to use and quick to modify in Procedural as I can in OOP? Probably not. Using OOP lets me compartmentalize and organize. By it's very nature of encapsulation it lets me create highly modular components, with the Authentication separate from say, the Resources (I've been using Zend Framework alot lately, so that's what pops into my find first).

 

In short, when it comes to short programs, I personally program faster in Procedural, I'm just used to it. When it comes to big modular projects, I usually end up with OOP. But it's mostly a personal choice, based on your own skill set and knowledge, so you really have to experiment properly with each to find your own answer

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.