|
|
|
|
|
by DigitalSea
4869 days ago
|
|
There are two sides of the argument and both have valid arguments. An ORM abstracts a lot of complexity when it comes to mapping tables, joins and sub-queries so if you don't understand the underlying SQL queries your ORM is performing and something breaks, you're at the mercy of the ORM to provide you with adequate error messages and means for debugging. The way of looking at an ORM is it is a framework for your database much like jQuery is a framework for Javascript and Rails is a framework for Ruby. You can get by using the framework but run the risk of not understanding the underlying structure and you're screwed if the framework you're using (or ORM) is no longer updated or works with your particular version of MySQL or whatever. Having said that, if you're using an established ORM like Doctrine then the possibility of ever needing to understand the underlying database structure and complexities is almost null. The time saving benefits, pooling, support for transactions, security best practices for your queries and caching features alone make an ORM worthwhile in the end. I think ORM's are great if you dig deeper and explore how the ORM works, it doesn't mean you have to write straight-up queries, but it pays in-case you are ever in a situation where an ORM isn't allowed by a manager or senior developer and you're asked to write a native query. |
|