tags:

views:

98

answers:

5

They seem complex and unnecessary. The applications I've built at work or home have never used any ORM and many of them haven't been even Object-oriented. Is it depenpable about size when they can be useful. How to determine how big a application should be when they be useful?

+1  A: 

You don't need an O/RM, but neither do you need a high level programming language such as C# or C++, you could just write your application using assembly. Those were the good old days ;-)

Steven
+1  A: 

There is no Silver Bullet. I am sure you must have heard it a lot of times. But its true. ORM is useful due to Object-Relational Impedance mismatch.
ORM allow you to think or program database in YOUR programming language.

Padmarag
Yeah that's the best part of it. Everything is just plain objects. No more sql strings..
poo
+1  A: 

ORMs do have distinct advantages over running straight-up SQL queries:

  • Save/update/delete an entire object graph
  • Versioning of entities to check for stale state
  • Better code maintenance and compile-time checking (SQL queries are magic strings)
  • Can generate database schema from object model

However, they do have some disadvantages:

  • Requires a sizable amount of time to set up
  • Mappings must be kept up to date
  • Even though it maps tables to objects, you still need to know SQL
  • Slower than straight-up SQL (but only apparent when doing bulk operations)

Overall, the benefits of learning and using an ORM far outweigh its disadvantages, in my opinion.

Daniel T.
A: 

Like Padmarag says, ORMs aren't a silver bullet.

If you have a hugely complex (object-oriented) domain model you might be better off using an Object database.

Frank Shearar
A: 

ORM-Mapper are nowadays the way to communicate with RDBMS. But you don't need in every application an RDBMS. There are several NoSQL-Solutions, which are maybe more appropriate to use.

But there are use-cases where I don't prefer an ORM: Reporting an batch processing: Here it's a question about performance an also a question of the complexity of queries. In a such scenario there is maybe the use of stored procedures more appropriate.

p2u