jake2891 Posted January 16, 2011 Share Posted January 16, 2011 hey guys id just like some input when you should use oop programming and when you should use procedural programming? Quote Link to comment Share on other sites More sharing options...
trq Posted January 16, 2011 Share Posted January 16, 2011 It's not simply that black and white. Quote Link to comment Share on other sites More sharing options...
ignace Posted January 16, 2011 Share Posted January 16, 2011 It depends on the task/application. I write crawlers in procedural for example as OOP would be too much overhead. Quote Link to comment Share on other sites More sharing options...
tibberous Posted January 16, 2011 Share Posted January 16, 2011 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. Quote Link to comment Share on other sites More sharing options...
Anti-Moronic Posted January 17, 2011 Share Posted January 17, 2011 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. Quote Link to comment Share on other sites More sharing options...
Garethp Posted January 17, 2011 Share Posted January 17, 2011 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.