Thursday, December 10, 2009

reserved words in MVC

There is no other words to express my disappointment with object relational mapping framworks than: woeful

I have played with three MVC frameworks (Catalyst/perl, rails/ruby, grails/groovy) and by one metric, Rails is pittyful. That metric is narrow but significant (in my opinion) and is described below.

The object-relational mapping frameworks in question are:

Catalyst/DBIC
Rails/ActiveRecord
Grails/Hibernate

My issue is that all these frameworks have implicit 'reserved words'. These typically throw an obscure error if you use in your Models because they collide with either framework or DB reserved words.


Let me draw up a table:

Framework
# reserved words
notes
DBIC
0 + db dependent
DB reserved words are not permitted.
Hibernate
0 + db dependent
DB reserved words are not permitted.
ActiveRecord
7 + db dependent
based on Reserved words in Rails blog post from 2007

So, there is an important uncertainty here: DB reserved words.

Irrespective of db reserved words, the frameworks differed on DB reserved words - so your models aren't portable across DBs. Am I alone in feeling this is a real lost opportunity for relational mapping frameworks?

I have still not seen a reason why these 'reserved words' restrictions exist
All (?) decent DBs will (I think) allow you arbetary table names with by quoting db names...
From an architecture perspective, having reserved words for something which is supposed by be abstract is just perverse.

I await the end of 'reserved words'.

UPDATE: This post is poorly researched. I discovered an additional resource in a blog post by Daniel Butler. However, my experience still points to Catalyst being an good choice of MVC framework when dealing with large legacy databases.

No comments: