[Pycon2005-attendees] The Database Divide
stefano at pragma2000.com
Fri Mar 25 07:53:05 CET 2005
[ I hope this is not too OT ]
I don't believe in this relational vs. obj oriented division of the world.
Relational databases are complex systems that provide many features for
retrieving data and for enforcing integrity rules.
On the other hand object oriented approaches generally share the common
decision of using a very thin layer of simple object persistance mechanism.
Therefore, by going down the road of object oriented, it's not like
choosing black instead of white, or viceversa. It's more about deciding
to polish on the functionalities provided by the storage framework and
rather move all of the business logic inside the program, instead of
having it in the DBMS.
I find your examples rather simplistic. You can't really say that the
relational approach is more complicated because it forces you to write
complex queries. A number of systems for automatically generate sql have
proliferated, and people have done a very good job at it. If you are
going to build a big system, you'd probably do something like this.
Nobody likes writing sql.
In other words, you can wrap your dbms functionality in such a way that
it looks much more object oriented if you want.
The real problem, in my opinion, is that even if you do wrap your DBMS,
you're still stuck with the quite rigid structure of your relational
database. It's not easy to refactor the structure of a database once you
Ok, I can already hear hundreds of experienced db gurus jumping up and
screaming: you are *not* supposed to change the structure of your
database. If you do, it means that you did not do a good analysis to
begin with. And they're right. But this is somewhat opposite to the
priciples that XP is trying to promote. That is you are *encouraged* to
refactor your code as much as possible, because when you begin a project
you don't yet know where you'll end up, so don't even try to do early
overdesigning, but do little steps at a time and change your mind if you
In this respect I think a pure object oriented approach to the problem
of storing and retrieving data could help. Refactoring in such a world
is probably a less painful operation to do than in a relational world.
As far as retrieving data is concerned, I don't think that object
oriented is limiting. You are assuming you can organize your data using
only simple data structures like lists and dictionaries, but nobody
prevents you from using more complex stuff, like btrees. There are tons
of indexing techniques one may use to speed up retrieval. David Binger
yesterday was talking about this when somebody brought up the question.
And he's right: you can choose the data structure you find most
appropriate. Think simple to begin with, and if performance becomes a
concern, then begin using something more complex and performant.
Well. These were my 2 cents. Thanks for bringing this up.
More information about the Pycon2005-attendees