2

I had a very stimulating and interessting discussion with a colleague about ORM and it's Pros and Cons. In my opinion, an ORM is useful only in the rarest cases. At least in my experience.

But I don't want to list my own arguments at this time. So I ask you, what do you think about ORM? What are the Pros and the Cons?

vcsjones
  • 138,677
  • 31
  • 291
  • 286
derphil
  • 385
  • 6
  • 25

2 Answers2

2

Very broad question.. I wrote something about ORM/PHP here. So IMHO I disagree with you, it should be the other way round. Don't use it in rare cases..

Community
  • 1
  • 1
duedl0r
  • 9,289
  • 3
  • 30
  • 45
2

Your question is very broad and ambiguous. That reminds me of the quote about capitalism being bad, but nothing better is known.

Just to briefly express my opinion on this topic:

Actually ORM helps you to quickly implement a data-base connectivity and implement your application logic without paying much attention to the actual connection to database. You are allowed to use the entities of your programming language while implementing the logic and you don't have to care about how these are then translated into the relational model of database. This is the main advantage for me and that is why ORM is so popular -- you can develop a simple data-driven application in just a couple of hours.

So, ORM, as many other technologies like managed code, garbage collection, generics etc. is optimized for developer productivity, e.g. to minimize the number of developer hours (that are normally quite expensive) needed to implement certain functionality.

As long as you have other criteria that may override the above mentioned one, like performance, application size, flexibility of the logic, network throughput, code size (both of the source and compiled) ORM is not your friend anymore. But since this is not a common scenario people usually don't care and take ORM for their applications.

Alexander Galkin
  • 12,086
  • 12
  • 63
  • 115