On Fri, 14 Jun 2002, Gunther Birznieks wrote:

> Would one of you mind providing a 1 paragraph definition of each? I am
> afraid that I am starting to get lost in the semantic differences of
> controllers and actions and O/R, R/O?....

Well, here's my take on it.

An Object-Relational mapper takes objects and stores them in a relational
database, as transparently as possible.  I think the most pure example of
this I've seen in the Perl world is Tangram (www.tangram-persistence.org).
SPOPS is also an O-R mapper (actually, its a generic Object persistence
mechanism but it seems to most feature-rich when used with an RDBMS).

A Relational-Object takes a relational database, and provides access to it
(select, insert, update, delete) via objects.  Class::DBI, Alzabo, and
DBIx::RecordSet are examples of such a beast.

I think what it comes down to is "how do you start thinking your project?"

If the first thing you think about is classes, objects, hierarchies,
delegation, etc., then an O-R mapper may be for you.  Most applications
need some sort of persistent data storage, and if you think of your app
solely as a collection of objects, then an O-R mapper is a natural fit.

However, if you're like me, and given an app, the first thing you think
about is _data_ and relationships, then a R-O mapper may be better.  I for
one start a project by designing a relational schema for the data.  Then I
want some nice programmatic way to get at it so Alzabo is key for me.

Of course, all this assumes some large amount of persistent data, as is
the case with many (but not all) web apps.

OTOH, if you don't have much (or any) persistent data, this is all
meaningless.  For example, when I work on Mason I think objects.

But when I work on my Hong Kong movie DB project, I think about tables.  I
have 90-some tables and I don't really want to create 90-some individual
classes, plus some ungodly number of "query classes" (as proposed by
Perrin) to deal with it.  Thanks, but no thanks.  OTOH, I hate writing raw
SQL and I hate generating SQL dynamically even more.  Alzabo provides a
nice layer over SQL, provides a multitude of convenience methods, has
hook/trigger support, supports caching, transactions, and facilitates
writing additional "canned query" methods as needed, and much much more ;)


-dave

/*==================
www.urth.org
we await the New Sun
==================*/

Reply via email to