[nycphp-talk] e-commerce application design
rob at nyc.yamaha.com
Fri Aug 29 12:12:03 EDT 2003
I apologise if these questions are too broad in scope, but I'm working
on redesigning a medium-sized e-commerce web application written in PHP
with a Postgres database. I've already decided on the frame work
(MVC-type model based on the Phrame project using smarty for the view,
objects for my business model and a php file as the controller), but
there are a lot of other pieces I'm still considering and the same
question keeps coming up.. "Is this just overkill or will it help with
maintainability, reusability, etc.?"
Some of these questions are as follows:
1. I'll be using Pear's DB abstraction layer, but am still wondering
about a database class to encapsulate my sql, querying the db, and data
retrieval. I've seen libraries (like DB_DataObject) which create a
class for each table (with that table's columns as its class attributes)
that extend a base class which has functionality for building sql for
simple selects updates and deletes. I like this idea, but it seems to
get pretty squarely when it comes to joins and more complex queries. I'm
wondering if any of you have had a good experience with DB_DataObject or
similar libraries. My alternative is to have hard-coded sql and database
calls within each script, which seems like a poor choice.
2. I've also seen "form" classes to handle form elements and data
validation for all html forms (think oohforms, and others). This is a
little bit more difficult to implement when using Smarty templates, but
still possible. However, with only about 10-20 forms on the entire site,
it seems like it's potential overkill. Does the group have any opinions
about the best way to handle forms?
3. Lastly is a question that's specific to my frame work (the MVC
model). The Phrame project includes a huge array used to map the user's
request to an action. Although this provides a loose coupling between
requests and actions, which would be good for extensibility, it seems
like a pain to have to build and maintain this array. Alternatively, I
could just assume a 1-to-1 relationship between requests and actions. Do
any PHP/MVC gurus have an opinion about this?
Also, if anyone has any general tips for designing profesional-grade web
applications that they'd like to share, please do so.
More information about the talk