NYCPHP Meetup

NYPHP.org

[nycphp-talk] databases, classes, and you

Mitch Pirtle mitch.pirtle at gmail.com
Wed Oct 6 11:43:17 EDT 2004


Hi gang,

Here is another philosophical question:

When working with an existing database class, it is common to create a
separate class for all SQL (commonly called the SQL class or DML
class).  It is possible to just extend your database class and add all
the SQL/DML methods there, as opposed to creating a completely
separate class that defines all of your database calls.

What are the pros and cons of this approach?

For example, building a site using PEAR::DB, why not just extend the
DB class with the site-specific methods?  Or is it really different to
keep that logic in a separate SQL/DML class?  To me it appears that
you are basically getting the exact same thing in the end; but would
love to hear a spirited debate on this topic.

Perhaps this could be something worth writing up for the NYPHP site?

Discuss ;-)



More information about the talk mailing list