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>



Django Admin Ominigraffle Stencil|(0)

Colleague Alex Lee has created a nice stencil for omingraffle with the Django Admin UI components, perfect for wireframing customised admin screens. For more details and to download the stencil see Alex’s Blog csensedesign.co.uk

Scrolling issue in Leopard cured with PRAM reset|(0)

Having got a shiny new MacBook Pro to work on at my new workplace I’ve had a couple of strange problems with Leopard. The main issue was that when scrolling the graphics was suffering what appeared to be a strange redraw problem when scrolling. After googling I found this post:“Distorted graphics in Leopard when scrolling”.

Fortunately for me: resetting the PRAM has worked and the flickering issue has gone for now.

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by 1&1 This page was baked in 0.707s.