| I, as an author of such library, am a bit biased but still... For one, you may get massive, massive developer productivity by eliminating loads of queries. In a lot of ORMs you do things like myObject.save() instead of generating a insert/update query for the particular state of myObject without taking into consideration which fields of the object is currently set. This reason alone enough for me to use them. Second, bunch of additional functionality usually come out of the box with ORMs, such as JSON or arbitrary (de)serialization of columns, caching, logging etc which you would have to spend time on custom implementations of these otherwise. Third, like you mentioned, some allow very easy change of database vendor. Fourth, mental abstraction from the underlying data storage (you stay in your language's domain) which again contributes to the productivity. Some other benefits include not seeing large SQL strings in your code which make it more difficult to read and maintain, security and ability to easily reason about what the code intends to do. I don't want to sound arrogant (not my intention at all) but I believe those who don't understand or downright rejects the benefits of a decent ORM system are either the ones that never used one to see the productivity benefit or those who work on projects that need to squeeze the last bit of optimization. In a large enough project it is seriously pain and time consuming writing all those queries which could be elegantly avoided. |