I've Seen The Light -- Why I Now Think ORM Use Is Important

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

I've Seen The Light -- Why I Now Think ORM Use Is Important

Post by volomike »

After years of doing parameterized SQL centralized in a class of public variables (named a conf file in my case), 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. Of course, even if you use an ORM, you can still either subclass to provide something extra, or write your own custom PDO/SQL function to do something special.
Post Reply