views:

120

answers:

2

Possible Duplicates:
Are there good reasons not to use an ORM?
Why should you use an ORM?

Hello, i develop since many years in SQL (many different sql servers like Oracle, MSSql, Mysql) and i always been happy in doing that. I've recently seen a lot of stuff around ORMs and i'm asking why should i move toward this world. Can you give me some good points for spending time in learning a different way to do what i already do today? Thanks in advance c.

+3  A: 

The advantages I can see, from doing a few database projects (without ORM) are:

  1. A large chunk of code that does CRUD (Create, Read, Update, Delete) can be simply conjured up by writing a mere XML file or instantiating a couple of objects. This can give you a huge head-start.

  2. You can define your schema in a single location, ie, the XML file or couple of objects. This is fantastic, as it implements the DRY principle!

  3. A nice, clean abstraction of objects is given to your object-oriented application to access data, as opposed to maybe some hackish objects you created yourself (depending on your programming skill).

The disadvantages:

  1. The ORM's abstraction can leak, and give you headaches in trying to figure out the magic it is doing in the backend when it doesn't work.

  2. ORMs aren't available for many languages, or are in alpha stage (C++, I'm looking at you!).

NB: I must admit I haven't used an ORM yet, but I plan on using one for my next project.

sheepsimulator
+3  A: 
Abel