Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)

From: Sasa <>
Date: Sat, 03 Jun 2006 09:20:39 +0200
Message-ID: <e5rd7s$h2k$>

mAsterdam wrote:
> One key facility would be the /sharing/ of data;
> between instances of applications (persistence can be
> viewed as a specific case of this: sharing between
> subsequent incarnations/runs), but also between different
> applications.

No one ever disputed that (well at least, I didn't dispute it), but is this simply not the consequence of persistance? I mean - flat files offer this facility as well.

Now, I am very well aware that RDBMSes are much more powerful than flat files, but in my current view - I regard both primarily as a persistence from my OO biased perspective. Why do I usually choose RDBMS over flat file? Because of this great features you and other have mentioned. Do I treat then RDBMS as a flat file? Most certainly not - I have a isolation layer which decouples my OO code from my RDBMS code. Behind that layer I can fully leverage the power of RDBMS. From the client side I'm not aware of RDBMS existence.

When analysing or debugging the data I most certainly use the query editor and write ad hoc queries to find out what interests me.

I worked on a legacy app which used proprietary flat files for persistence. It was a nightmare when I had to analyze what's in there.

So no, I don't think I'm fully underestimating the power of the dark side :-) Sorry just couldn't resist - no harm meant there, I meant the power of the RDBMSes. I am open to the possibility that RDBMSes can be ever more used than I am currently using them, and are much more appropriate for some stuff I currently do in OO. But to accept this notion I would need more specific details on your preferred approaches.

> Why not? Simply serializing/deserializing all objects
> (like smalltalk did - the "system image")
> to a file on secure media gives you perfect persistence.
> That you want more shows that you already are
> aware of some desiderata beyond just that.

Well to me, most of these other features are rather "persistence related".

>> Given the fact the DBMS can serve more apps (but actually even one can 
>> mean trouble if SQL code is spread around the app code), and given the 
>> fact that one app might want to switch DBMSes I think it would be 
>> smart to decouple both as much as possible, which to me means no 
>> client code in DBMS, and very localized DBMS specific statements in 
>> client code. Now 

> "no client code in DBMS" - could you give an example of what you'ld
> consider typical client code?

As can be seen from my other posts, I write my domain logic (the core business data and behavior) in OO and use RDBMS for persistence. The data is hence in the database only because it must persist. Moving the behavior to the DBMS would mean moving client code (the non DBMS code which somehow directly or indirectly uses the database) to the database.

I was working on a financial application once, where a lot of such logic was implemented in the SQL database. There was number of large stored procedures which performed complex financial calculations. The code looked horribly - with lot of verbose, bulky IF THEN ELSE blocks, etc. it reminded me more of my BASIC days than of the professional code.

In addition, the app was being distributed to different clients. Between any two clients some subset of the calculation algorithm varied to some degree, with most of the logic being the same.

This was being resolve by simply switching the stored procedures code - for each client we had the SPs scripted. The structure being used (tables) was the same.
So if we wanted to work on an app for another clients, we would execute appropriate scripts which would then regenerate SPs and then we would have the appropriate code. Needless to say, there was fair amount of duplication (or rather n-plication) with slight variations in some places.

To summarize - there are two problems:
1. Complex ifological sequential logic
2. Code reuse which supports variations on appropriate places

Now, I have fairly good idea how to resolve these in OO, but have no idea how do you deal with such issues in DBMSes. Simply, when it comes down to the behavioral, sequential code, and as far as I know it has to come down to it sooner or later, I regard OO as a better choice.

Disclaimer: I can agree that the example just presented was simply bad implementation (it most certainly was).

>> I'm interested with what part you DBMS guys (no irony, or offense 
>> meant) disagree and how do you envision it?

> I'm not fond of the us vs. them approach - but I am a c.d.t. regular.

Well I'm obviously on the OO side, but would like to hear some specifics from the cdt guys, to expand my horizons, learn something new, shift my way of thinking etc.

Do you think OOLs are inferior to RDBMSes in all aspects, and if so are they redundant? If yes, of what parts (with respect to languages) should a typicall application consist? Do you apply such approaches in your apps and how does it works for you?

Sasa Received on Sat Jun 03 2006 - 09:20:39 CEST

Original text of this message