[sf-perl] ORM vs. DBI

David Fetter david at fetter.org
Sat Feb 26 23:04:36 PST 2011

On Sat, Feb 26, 2011 at 11:00:37PM -0800, Michael Friedman wrote:
> Fellow Perl Mongers,
> I finally got around to reading up on and trying out DBIx::Class. It
> looks pretty neat, but after loading up a complex DB (108 tables)
> and writing a short test script, I really don't understand why you'd
> want to use it over using just regular DBI and SQL. Maybe it's
> because I knew SQL before I knew Perl and I'm training in looking at
> things in a SQL way, but I'm not so sure. 
> So I'd like to throw the floor open to discussion. Why would you
> want to use DBIx::Class (or any Object-Relational Manager) instead
> of writing classes that call the DB directly through DBI?

There's nothing about an ORM that requires that it also be an SQL
generator.  The SQL generator is a ubiquitous and separate feature of
ORMs, written for the benefit, for lack of a better word, of people
who hate and fear SQL, and don't want to be reminded that they're
using it.

You can still use the mapper, which is what ORM (Object-Relational
Mapper) actually means, without using the SQL generator, at least in
the good ORMs.

David Fetter <david at fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter at gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

More information about the SanFrancisco-pm mailing list