PHPBuilder - Smart Architectures in PHP Page 4

RSS Twitter

Smart Architectures in PHP - Page 4

by: Tim Perdue
October 10, 2000

2. Presentation Independence
Once again, you don't really know where your web site is headed or where technology is headed. I was never a big believer in this - HTML is really the standard, especially in web apps. If that ever changes, I figured I could always rewrite.
But if you get to where you have a truly huge, complex app, then you need to start thinking about alternative interfaces to your database. What you don't want to do is start copying and pasting logic, permission checks, etc around your site. Let's say you need to make your site WAP-enabled so cell-phone users can surf. If you designed your app right, you can just write a thin WAP presentation layer that calls all your data-access objects. If you didn't design your app right, suddenly you have to maintain both an HTML version of your site and a WAP version.
I'm running into this on SourceForge. We have this huge user base of people who want to submit/fetch their bugs, tasks, etc. At first, we figured it would all be through our web interface. Then with some pressure from people like Eric Raymond and others, we've decided to expose the database using an XML interface.
Fortunately, we undertook an effort back in April to separate out the core logic of the site from its presentation. I'll try to explain how we did this, and hopefully others will chime in with their own methods.
The bug tracker and other tools on SourceForge are now split into two distinct libraries - the HTML library and the data library. The data library checks to make sure the right values were passed in, handles security checks, and basically returns only true or false on success/failure.

« Previous Page
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Tim Perdue



(Maximum characters: 1200). You have characters left.