From: Chad Perrin Date: 2007-10-18T03:00:44+09:00 Subject: Re: recommendations for working with PostgreSQL On Thu, Oct 18, 2007 at 02:37:39AM +0900, Thomas Adam wrote: > On 17/10/2007, Chad Perrin wrote: > > > > I'm not necessarily looking for ORM, though now that I think about it I > > can't help but wonder if every single programmatic interface between Ruby > > and a relational database might qualify in some manner as ORM (since > > "everything is an object" in Ruby). In the Perl world, I'd tend to use > > But then, just because the language you're using means everything is > an object, does not mean to say that when you connect to a database > and start pulling stuff out of it that what you get is ORM. ORM is an > interface your application would define for itself, mapping to the > underlying tables/views/whatever in the database. > > Ruby makes this easier in that you could just (at a crude level) map > an object you define to have properties, behaviour and scope of the > underlying tables, etc., in the database. Sometimes there is merit to > that -- and indeed, coming into this are things like patterns (the > factory pattern in particular is useful in ORM scenarios.) Thus, my "in some manner" qualification. The comment about all programmatic DB interfaces in Ruby being ORMs was really a throw-away, not exactly meant to be taken in strictly literal fashion. Sorry if that wasn't clear. > > > DBI for all things database-y, and was wondering what the preferred > > approach would be in the Ruby world especially in the case of PostgreSQL. > > Having written numerous libraries (well, OK, two) in both perl and > ruby, I can honestly say that whilst it's somewhat "easier" in perl > (you're not forced to go down the abstracted route of ORM design) you > lose a lot of functionality -- the scope of what you can write in Perl > diminishes since the interface subroutines rarely map in an ORM way > [1]. Look into it heavily with Ruby -- it will make life easier. Thanks for the advice. I shall (look into it heavily). > > [1] Anyone who things writing OO Perl is a good thing for this; think > again. OO perl is just broken. I certainly don't disagree much. It's not any more broken, really, than OOP in languages like C++, but they're pretty broken in that regard too. Just my opinion, of course. In general, I love Perl -- but in terms of its OO constructs, I do not love it. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Patrick J. LoPresti: "Emacs has been replaced by a shell script which 1) Generates a syslog message at level LOG_EMERG; 2) reduces the user's disk quota by 100K; and 3) RUNS ED!!!!!!"