M4DBI - Models (and more) for DBI

March 31, 2008 at 23:47

Filed under: Computing — Pistos @ 23:47

http://purepistos.net/m4dbi

M4DBI is a new project I’ve been working on for the past couple months. Visit the M4DBI home page for technical details and project info. Here, I will just excerpt the Rationale statement.


I’ve worked in the past with DBI, ActiveRecord, Og, Kansas and Sequel. I also have some experience with ODBC and JDBC.

ActiveRecord is good, but it took up way too much RAM on a server where memory was not an abundant resource. I also ran into various annoying and frustrating problems. ActiveRecord didn’t always play nicely outside the realm of Rails, and I was never sure how stable my application would be after upgrading ActiveRecord.

One thing that bothered me about these ORMs was the fact that they encouraged what I thought was overusage of Ruby or Ruby-ized syntax for things that could be just as (or maybe even more?) easily and cleanly done in SQL, namely: schema definition and basic queries. I am reasonably proficient in SQL, so I considered this Rubification somewhat unnecessary, and also thought that sometimes it only obscured things because one would sometimes wonder what the underlying raw SQL was for the DDL statements or queries. Why not state it explicitly?

I also had POLS violated. Now and then I wouldn’t have a record set in memory when I thought I did (due to the maximally-delayed fetching design of Sequel); or a record which I operated on in Ruby didn’t have its changes synced to the database because I forgot to #save() it.

A general impression I got from these ORMs was that the ORM was being used to mould, contort and manipulate the database. I always thought that this was backwards; rather, the DB is the reality, and the ORM should conform to it, and convey the truth about it. Otherwise, it would be like having a camera which would alter the physical things that it was taking a picture of, instead of the camera merely being a viewport on the reality.

I realized that all I really liked about ORMs are models and the relationships between them. Otherwise, I really just wanted the low-level power and intimacy of SQL, married to the beauty of my favourite language, Ruby, topped off with these pleasant extras, models and relationships. And so M4DBI was born, as an attempt to address all the above issues.

Share This

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You may use Markdown syntax in your comment.

Powered by WP Hashcash

Powered by WordPress.
Close
E-mail It
Socialized through Gregarious 42