never_had_a_name
never_had_a_name

Reputation: 93216

code comparison between ORM (doctrine) and SQL?

i've read a lot about ORM but wondering if there are side by side comparison examples between an ORM like doctrine and SQL so that you could see what is more easier to maintain?

couldn't find such comparisons in google.

Upvotes: 3

Views: 358

Answers (2)

Your Common Sense
Your Common Sense

Reputation: 157888

"easier to maintain" is subjective. ORM always has some limitations. It is attempt to put flat relational SQL into procrustean bed of OOP. If you're big OOP fan, ORM is probably for you. Otherwise go for SQL.

In the other words, ORM make general purpose tasks simpler but any unusual task become pain in the neck.

Upvotes: 3

Joril
Joril

Reputation: 20547

I don't know of such code comparisons, but personally I prefer using an ORM since it allows me to express queries in "business" terms, instead of "table" terms.. For example

Query(Customer).filter_by(Customer.address.has(Address.state == 'Whatever'))

Upvotes: 1

Related Questions