Wow, that's a lot of stuff in one class. Personally, I've started using the MVC (Model, View, Controller) architecture. Basically what it does is seperates Data logic from Display logic and Control logic. Here's how I've been using it.

Model: Holds and deals with all data for the program, such as database connections / queries, session data, data consistency. I am currently using classes which use PEAR DB_DataObject for DB connections, querying, and data storage.

View: Deals with displaying of data from model. ONLY does displaying, no processing. Very minimal logic only associated with outputting. Currently, I am using Smarty entirely for the view. Little no no PHP code, only Smarty. The View in this case is just a smarty template file.

Controller: Handles requests from the browser. Instantiates Model and View, calls functions in Model to alter its state (updating from $_REQUEST vars, for instance). Chooses a view and then tells the view to display. For me, this is all home-grown PHP.

This architecture can be much more complicated in, say, a C++ program, but the Server/Client pattern built into web programs makes it much more simple. The reason that I use this particular architecture is that it factors all of the pieces of your program very nicely. Later, if you do things right, you can use a single screen from one program in another with minimal editing.

Here's a few pages that discuss MVC:
http://ootips.org/mvc-pattern.html
http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to