I've been paid to be a software developer for almost 7 years now and the truth of the matter is that all through that time I've been following the OO design principles, knowing the benefits and only occasionally making use of some of the large advantages. But two nights ago (I've been meaning to post since then) it came to my rescue.
A bit of background - I've been developing a website for a friends printing business in my spare time (www.rooprint.com.au). I threw myself into it going through a proper design and have spent some good hours setting up a good framework for the website with PHP as the backend because of the options with his web hosting company. I normally avoid anything HTML related, because cross browser development is down-right evil... but having been playing around with it at work I got excited by the prospects of AJAX for a second or two (the site currently only partially works in any other browser than firefox - I'll probably post more about this later).
Anyway I had the site up to a stage where I needed to put it on the net for me to show my friend, and also to allow me to test all those evil browsers that don't work. So after battling through a local install of PEAR and then HTML_AJAX within the local user area I came to try and view my lovely creation and learnt the hard way that the hosting company only really has PHP support on the server so they can run PHPMyAdmin. What does this mean? That the MySQL PDO driver wasn't installed, and "couldn't" be installed.
Thankfully I had followed good OO design principles and written a wrapper class for all database queries. With a little bit of work and a lot of learning about the mysqli PHP extension I rewrote the class with use mysqli and whacked it in and all works peachy - no changes to the actually code running around it. Well I did make one change - I decided not to implement the equivalent wrapped call to
pdo_statement->execute(array)which I was using in one instance rather than binding the parameters individually.