Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here are 3 primary advantages I can think of:

* Ability to programmatically add to/chain queries. It's really simple to add an additional "WHERE" clause in an ORM query; it's much harder to do so with a SQL string, where you have to account for escaping, comma placement, etc.

* Ability to automatically join entities in some cases, which can save on verbosity.

* Ability to add methods and attributes to models, which can abstract away additional queries or queries that might normally be really complex.

It's debatable if ORMs really add that much to productivity. I use them in some projects, and forgo them in others. For Python, I'm a big fan of Pony ORM because it can greatly reduce verbosity and basically maps Python code directly to SQL; I don't really use it for the relational "mapping" though: http://ponyorm.com/



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: