Thoughts on SQL vs ORM

rusi rustompmody at gmail.com
Wed Feb 6 13:03:08 EST 2013


On Feb 6, 5:58 pm, Andriy Kornatskyy <andriy.kornats... at live.com>
wrote:
> The question of persistence implementation arise often. I found repository pattern very valuable due to separation of concerns, mediate between domain model and data source (mock, file, database, web service, etc).
>
> The database data source is somewhat specific since you can proceed with SQL functions or ORM. Here are some thoughts why you might prefer SQL functions over ORM in your next project:
>
> http://mindref.blogspot.com/2013/02/sql-vs-orm.html
>
> Comments or suggestions are welcome.
>
> Thanks.
>
> Andriy Kornatskyy

Interesting read. Your first 2 points:
1. It is not valid to think that relational model in database is
domain model of application. They are different (except some trivial
cases).
2. … Design your domain model with plain objects only

And then later you go on to recommend SQL over ORM. So its not clear
which side you are on!

My own very preliminary thoughts on this:
SQL is basically a functional language.
OOP is just imperative programming with some syntactic sugar, name-
spacing etc.
IOW OOP is a lower level paradigm than FP because it deals with the
'how' more than the 'what.'

Object-relational impedance mismatch happens because of the opposite
reason to what people seem to believe: Because the higher-level SQL is
pulled down into the lower-level OO mindset and not the other way
around



More information about the Python-list mailing list