“Jeremy Z”:http://jeremy.zawodny.com/blog: “Database Abstraction Layers Must Die!”:http://jeremy.zawodny.com/blog/archives/002194.html
Apart from the fact Jeremy seems to be a mouthpiece for MySQL (oh wait, evangelist is the right word isn’t it?) and should therefore be in favour of programs that only work with one database (which would have to be the one with 90% market share), I think he is wrong for the majority of PHP users. These are a few reasons:
# Most PHP sites are not using relational databases as they should be. Rather, they are using the database as a convenient way to store data. News items, for example, could just as easily be stored in text files. Heck, the majority of an application such as “phpBB”:http://www.phpbb.com/ doesn’t _need_ the relational capabilities of a database. They’re just really convenient stores - they abstract the bother of extracting one row from a text file, and hide the problems of file locking and permissions.
# For the majority of scripts, portability is important, more so than performance. You get more users, more customers, if your script will work with their database. While the majority use MySQL, so you would lose a very small percentage of the market I like to support choice (and think how unique your product is: ‘WOW, a PHP script that supports _my_ database and doesn’t force me to use MySQL!).
# Increased speed of development. Pear’s “DB_DataObject”:http://pear.php.net/manual/en/package.database.db-dataobject.php speeds up development (when having to consider portability) and prevents me worrying about complex SQL queries not being portable. OK, I’m struggling to get my head around it, but everything has a learning curve
I have always used PEAR’s “DB”:http://pear.php.net/manual/en/package.database.php abstraction layer because it gives me one API to remember instead of 3. It may be a large amount of code (and I look forward to the day PEAR.php itself is slimmed down - I *hate* PEAR’s error handling) but saves me time.
“Jim’s take”:http://revjim.net/comments/10079/ on this makes for a good read.
Oh, and the “template rant”:http://www.sitepoint.com/forums/showpost.php?p=498687&postcount=15 Jeremy linked to, he might be interested to know that the author appears to have moved away from PHP. Not really a good example of what the rest of us should be following eh?
3 comments ↓
Good, you finally fixed your comments. I couldn’t find a way to contact you to tell you they were broken.
Anyway, how do you know that Vincent (author of the template rant) moved away from PHP, and do you know what he moved to?
It wasn’t the comments broken. “The host”:http://www.fluidhosting.com changed a setting on their server, and I had to add a ScriptAlias for ‘cgi-bin’ which wasn’t needed before. I didn’t spot this until I went to write a new entry. Gah.
To answer your questions:
A quick “search”:http://www.sitepoint.com/forums/search.php?searchid=875306 on SitePoint showed me that Vincent was working with J2EE, had not posted for quite a while, and in his recent posts spoke of not having used PHP for a long time. His Eclipse library appears to have been taken over by someone else. It is only my impression that he has moved away - I would be happy to stand corrected.
Designing Scalable Infrastructure
I think it is time someone spends some time writing a book about designing scalable infrastructure to help those who are currentlty having to go through the learning curve to learn how to design a scalable infrastructure for their application….
Leave a Comment