Drupal is impressive - at the very least in scope and participation. I like quite a bit of it. In contrast with Rails, Drupal releases seem to be Designed rather than Grown - which is a very strong plus. [I'm not sure I can stand it, but that's another story.]
But I'm not writing to Praise Drupal, but to make an observation about Object Relational data Mappers.
Drupal through 6 doesn't have an ORM. They have two 'database adapters' and opt to use SQL. Most of the SQL used for CRUD operations is standard, so that works just fine. I'm told there is discussion in the development forums about stuffing a layer of abstraction in the database code - which I read as 'create an ORM.'
Looking over the landscape littered with the corpses of ORMs in almost every conceivable (computer) language, should give pause - at least it does to me.
Why do we ORM?
Well, we have to have the data tables in the Database match up with the Attributes in the Objects, don't we?
Well, No we don't.
There's no reason for the Data Tables to model our 'business process'. That's a knee jerk reaction taught as gospel in C.S. courses.
Couple of Facts:
- Databases are really good at holding, retrieving, searching, and sorting vast quantities of data. Programming Languages aren't.
- Programming Languages are really good manipulating, displaying, inputing, validating, mashing, spindling, and folding data. Databases aren't.
It seems to me that there much of the data used in a web site could be modeled exclusively in the Programming Language and then serialized in XML or JSON for storage in the database. That separates the representation of the data in the application from the representation in long term storage and obviates the need for an ORM.
I like that idea so much, I'm building one now just to see how it works in practice.
Stay Tuned
2 comments:
Try doctrine-project.org, one of the best PHP ORMs out there.
I have just put up an initial version of a Drupal Node/CCK Orm. The project is still in it's begginning stages, but it actually works and is quite powerful. If interested, have a look here...
http://drupal.org/project/orm/
Post a Comment