
10-01-2004, 03:46 PM
|
|
Web Hosting Guru
|
|
Join Date: Jul 2003
Posts: 339
|
|
PHP - OOP or not?
I am considering making a large web based project in PHP, and I am considering the cons and pros between OOP and classes, and straight forward PHP. Can anyone give me some ideas or suggestions, and when I should use OOP based PHP?
__________________
High Quality Webhosting @ Low prices -
www.edgods.com
Quality since 2003
|

10-01-2004, 04:03 PM
|
|
Newbie
|
|
Join Date: Sep 2004
Location: USA
Posts: 28
|
|
Both methods are fine. In my opinion I use oop only when i am coding a feature that i think i might be able to use in the future for another project. By doing this you can slowly build up a librairy of classes :-) heh to make future development faster and easier... But also you dont want to go over board and do everything in oop as I have sometimes found that to slow things down for me.
btw this should probably go in the programming forum not in the employment one. just a thought.
|

10-01-2004, 04:20 PM
|
|
Web Hosting Guru
|
|
Join Date: Jul 2003
Posts: 339
|
|
But is OOP and/or classes recommended for larger projects?
__________________
High Quality Webhosting @ Low prices -
www.edgods.com
Quality since 2003
|

10-01-2004, 04:49 PM
|
|
Newbie
|
|
Join Date: Sep 2004
Location: USA
Posts: 28
|
|
well oop is classes... oop is the use of classes in your code.
Definitely for large projects i would use oop. :-)
|

10-01-2004, 06:20 PM
|
|
Junior Guru
|
|
Join Date: Oct 2001
Location: Ann Arbor, MI U.S.A.
Posts: 217
|
|
While I lean toward OO for most of my projects I would have to defer to "what you know and like best". I've seen soo many projects that choose OO because it's "better" or "betting for bigger projects" and the developers don't really have a handle on *why* it's better or how they can exploit OO to their advantage. I'd recommend this advice for all projects regardless of the OO or procedural implementation: DESIGN.
Many large projects use OO and many use procedrual, is one way better? who knows it's still debated to this day. But if you're used to one way and can perform the task efficiently one way then spending the time to "switch" to the other probably won't bring you the rewards that the other method touted.
Chris
Chris
__________________
█ Chris Wells [clwells - at - nexcess.net]
█ Nexcess - Beyond Hosting
█ Dearborn, MI DC ● Southfield, MI DC
█ Wordpress Hosting, Magento Hosting & More!
|

10-03-2004, 10:47 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Oct 2004
Posts: 89
|
|
What does "large web project" mean in this context?
In PHP, Perl and Python one can break the base OOP paradigms rather easily, so reaping full benefits from OOP requires as much experience and self-discipline as doing C OOP development (which is totally possible as well.)
|

10-03-2004, 04:19 PM
|
|
Web Hosting Master
|
|
Join Date: Dec 2002
Posts: 1,300
|
|
There can be some tradeoffs with OOP as well - Its proponents seem to imply that it is universally better in every situation, which is clearly untrue.
There can be situations where OOP adds overhead and can become a bottleneck, slowing down your script. On the other hand, it can be a much cleaner way to lay out a project and lends itself very well to code reuse and modification without rewriting many lines of code.
For that reason, in small projects, with one developer - use what you are comfortable with.
For large projects with complex interconnections and multiple developers OOP may be a LOT more attractive than procedural code if only for organizational and code-reuse purposes.
I sense that you probably know procedural programming already and are wondering if you need to learn OOP - the answer is dependent upon your sitation and the complexity of your project.
MY disclaimer: I usually work on smaller projects and prefer procedural programming 
__________________
"The only difference between a poor person and a rich person is what they do in their spare time."
"If youth is wasted on the young, then retirement is wasted on the old"
|

10-03-2004, 07:51 PM
|
|
Community Guide
|
|
Join Date: Dec 2002
Location: The Shadows
Posts: 2,900
|
|
This is really a one sided question, like someone pointed out above.
It is a choice of either "should I us OOP, or should i us OOP"
Well, the benefit of using OOP is that you can reuse the classes you make for more then one project. Or in more then one implementation in a project.
Depending on the size of the project though, it might be counterproductive to create classes for implementation. If you are goignt o be using more then three pages and/or filesize is larger then 3K, then you might be better off going OOP.
__________________
Dan Sheppard ~ Freelance whatever
|

10-04-2004, 03:13 AM
|
|
Newbie
|
|
Join Date: Nov 2002
Posts: 5
|
|
I think for straight forward PHP, it is also possible to reuse the code by grouping codes in functions. So reusable of code is not the attractive reasons of using OOP.
It should be the easier maintainability and debuggability that make OOP approach attractive. However, PHP 4 is not that good in OOP organisation. I heard that PHP 5 is designed with OOP in minds, so if you would like to use OOP approach, I would suggest you to use PHP 5, but the tradeoff is that there may not much host support it yet.
|

10-04-2004, 05:55 AM
|
|
Web Hosting Guru
|
|
Join Date: Dec 2003
Location: Karachi, Pakistan
Posts: 316
|
|
IMO, if your project is bigger than a certain size and a few developers are involved, OOP would help you in organization, reusability, extensibility and maintenance of your code. OOP isn't suitable for small project due to the extra overhead it brings but for large projects where many other paradigms beside fast execution matters, OOP seems the choice.
|

10-04-2004, 07:47 AM
|
|
Web Hosting Master
|
|
Join Date: Jan 2003
Posts: 1,715
|
|
As long as you plan out your project, either style will work. OOP strongly encourages interface and design forethought, so it does tend to work better in large projects.
__________________
Game Servers are the next hot market!
Slim margins, heavy support, fickle customers, and moronic suppliers!
Start your own today!
|

10-05-2004, 10:28 AM
|
|
Web Hosting Guru
|
|
Join Date: Nov 2003
Posts: 297
|
|
Quote:
|
OOP would help you in organization,
|
IMO this is the best part of OOP. It gives you clean breaks between different parts of the code making it easier to give one part to one dev, one part to another and maybe a third to a designer while still being able to tweek the "architecture" as a web master.
|
Related posts from TheWhir.com
|
| Title |
Type |
Date Posted |
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|