Thursday, June 26, 2008

ORM -- Oooooooh. I get it now!

After years of doing parameterized SQL centralized in a class of public variables (named a conf file), I think I finally see the light on why an ORM is useful.

Here's why:
  • The conf file would get huge on a project.
  • Several developers working on a project might obliterate each other's conf file under some conditions.
  • I would spend like 40 hours (over the entire course of a 3 month project) reviewing the best way to do something in SQL statements, when I could have been coding.
  • It's easy to make a syntax error in the SQL and not recognize it for a couple days.
  • I had to actually write all that SQL -- no tool would generate it for me.

However, with an ORM, here's the fix for all that:
  • No huge conf file for the SQL. You can split the database logic into classes that some guys can have, or that other guys can have, as their tasks.
  • I don't have to write out all that SQL for most of the project. Instead, I can focus on the code. Sure, if I want to build a difficult JOIN and type the SQL manually, nothing is stopping me from doing that, though.
  • Not having to write out all that SQL, there's far less chance for a bug to appear.
  • Subclassing is a beautiful thing in the right context.
So, I recommend you consider an ORM tool soon. And my favorite right now is Outlet ORM because of its small file size, the fact that it's very well written, has no bugs that I can find, and is well suited to many uses.

No comments:

Post a Comment