Muffinresearch Labs by Stuart Colville

OOP PHP What are the benefits? | Comments (2)

Posted in Code on 25th January 2005, 2:17 am by Stuart

Over Here at Sitepoint Harry Fuecks has kicked off an interesting discussion regarding the speed of OOP PHP versus procedural code.

What this exactly means requires qualification, as this would imply that speed of execution and speed of development are both to be taken into account to be fair. What I have found since using OOP PHP in web development is; where you are looking to create something that can be easily re-used, adapted/extended and improved, then OOP is the way to go.

Procedural code can be messy and hard to adapt later on. I currently work within a team of several developers where on occasion I have to modify other developer’s code. It’s usually the scripts which have utilised classes which can be quickly understood and changes be made without having to spend too much picking apart the code line by line to understand the flow.

I see OOP php as being similar to the way that using XHTML and CSS allows separation of structure and look from content; except OOP PHP separates functionality from implementation.

I will be watching this debate with interest to see the outcome of Harry Fueck’s OOP/Procedural comparision

Post Tools

Comments: Add yours

1. On January 27th, 2005 at 12:05 am John said:

I don’t really think there’s much of a debate to be had. Like the “how old a browser should you support” arguments, how heavily you value extensibility over performance depends almost entirely on what kind of application you are writing, who you expect to use it, and how often you anticipate changes. If you are making a very stable, high-traffic project, clearly you are going to want to lean towards speed and performance. But in my experience most PHP apps are intended for small audiences who’s needs are either rapidly changing or poorly defined — thus making on-the-fly changes more important.

Whenever I work on an app, I ask myself how many people are going to be using it and how often. If one or both of those numbers are small, I always lean towards OOP-style coding, just because it is easier to maintain and my audience won’t notice a fifty millisecond slowdown.

2. On January 27th, 2005 at 12:56 pm Stuart Colville said:

The key point you make is a valid one in that, this whole thing means different things to different people. My own view on the whole thing certainly relates more to practical usage than any concerns about speed of execution. For me, repetitive tasks are best done with classes and now that I use classes I won’t be going back.







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Using Loggerhead with mod_wsgi|(0)

Here’s a post I wrote over on the Project Fondue Blog about our use of Loggerhead with mod_wsgi under Apache. Loggerhead is the rather nice branch viewer for bazaar branches as used on Launchpad.net.

If you’re not already subscribed to the Project Fondue blog feed then I can recommend it, as there should be some interesting posts coming out of there in the coming months (yes I’m unashamedly biased!).

Ubuntu: Turn off changing workspace with mouse wheel|(1)

I found the changing with the workspace with the mouse wheel really annoying. To disable it go to System => Preferences => CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck “Viewport Switcher” which is under the “Desktop” heading.

Photos on Flickr

© Copyright 2004-10 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.616s.