NYCPHP Meetup

NYPHP.org

[nycphp-talk] ORM anyone?

Ken Downs ken at secdat.com
Tue Sep 11 19:07:04 EDT 2007


Ajai Khattri <ajai at bitblit.net> wrote:  > On Tue, 11 Sep 2007,
Kenneth Downs wrote: >  > > As you may guess, I'm no fan of ORM. 
The main reason is what I just  > > said above.  OO code and
table-based data are two very different beasts  > > with very different
natures.  ORM tries to make one look like the  > > other.  Why would
anybody want to do this? >  > For a couple of reasons: >  > 1)
Dealing with SQL from an OOP programming language is not natural.That's a
personal opinion, not a system requirement.Hey, that's fine.  My opinion
is that generating SQL is natural and easy, a little easier than generating
HTML. >  > 2) Conceptual relationships are easier to deal with via
objects.What's a "conceptual relationship?"  If you put your
data into tables, then the relationships between the tables are foreign
keys.  That's easier to handle in set-based SQL, the language that was
designed to do it. >  > 3) It gives you a layer of abstraction above
the database to the >    degree that it doesn't matter what the underlying
database >    actually is, you have a uniform interface always. Doesn't
matter >    if you switch SQLlite to MySQL to Postgres - all looks the
same. >  Actually you don't need ORM for that, you just need a generalized
set of commands, like "db_query" instead of "pg_query" and
"mysql_query". 
_________________________________________________________
This mail sent using V-webmail - http://www.v-webmail.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070911/de10045d/attachment.html>


More information about the talk mailing list