[UPHPU] to ORM or to NOT

Roberto Mello roberto.mello at gmail.com
Mon Aug 16 10:55:50 MDT 2010


On Mon, Aug 16, 2010 at 10:28 AM, Jonathan Duncan
<jonathan at bluesunhosting.com> wrote:
>
> As I see, it, the DB agnostic angle is THE angle.  I have been using the CakePHP framework which has an ORM built-in.  Learning to use the Cake ORM instead of straight SQL had a learning curve but since the ORM tackles so many of the tedious work that I usually had to do manually it was worth the time, to me.  It really depends on what you are using the ORM for, how often you plan on using it for this project and future projects.  If it is a one time deal, it may not be worth it to you.

It certainly is THE WRONG angle for most applications, except for the
cases where you are going to sell your app, and support for multiple
databases is a must.

There is value in using the advanced features of the database of your
choice in your application. Performance, agility, speed of
development, full text indexing and searching, geospatial addressing,
and many others. If you care about your application, you should care
about those things.

Trading those off for lowest-denominator, software-generated queries
certainly works, but make no mistake: it is a trade-off, and you are
paying for it. This is not cross-platform compilation, where you have
#ifdef's of code that run on this or that platform. The impact on your
application goes much deeper and wider, and should be carefully
considered.

ORMs provide other attractive features, ease of coding probably being
chief amongst them. I believe it to be a mistake to detach yourself
from the relational model you are ultimately using, in search of
object-oriented nirvana. That too is a trade-off, one with a high
price.

Roberto Mello


More information about the UPHPU mailing list