Re: Mixing OO and DB

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Mon, 10 Mar 2008 19:28:34 -0500
Message-ID: <2008031019283444303-unclebob_at_objectmentorcom>


On 2008-03-09 01:02:47 -0600, Marshall <marshall.spight_at_gmail.com> said:

> On Mar 8, 6:07 pm, Robert Martin <uncle..._at_objectmentor.com> wrote:

>> On 2008-03-06 15:37:56 -0600, topmind <topm..._at_technologist.com> said:
>>
>>>> Each small group of classes becomes a little roll-your-own data access
>>>> and manipulation scheme that is perfectly tuned for it's very specific
>>>> purpose.

>>
>>> Which is over-kill for the task-level.

>>
>> Do you have proof that it's overkill? Do you have any objective
>> measurements that it's overkill? Or it is just your own opinion. I
>> mean, if it works for you that's great, but don't force your own
>> opinions on everyone else <grin>
> 
> This is a fallacious argument. You're proposing extra effort without
> justification. The idea that, in the absence of evidence either way,
> topmind's proposal of not putting in that effort is on equal footing
> with yours doesn't hold. Extra effort requires justification. What
> you are saying is, "hey, we don't know if this work has any value
> or not, so doing it is just as justified as not doing it."

Go back to the root of the argument. You'll see that the initial premise is that the programmer organizes the data into a form that is more convenient for him to get his computational job done. So there *is* justification.

>> It is very common for programmers to manipulate data into forms that
>> are particularly convenient for the application they are writing.
>> Databases are seldom in that form since (for one thing) they must
>> usually serve many different and competing applications.

> 
> (I'm going to just label the above as bogus without justification.
> It's late and I'm lazy.)

That's fine. Consider, for example, an algorithm that finds the minimum spanning distance of a graph. (e.g. cheapest network route, or cheapest travel itinerary, etc). The node and edges of the graph are stored in database tables.

Shall we execute that algorithm by doing thousands of tiny queries as we walk from node to node through the edges? Or shall we query all the nodes and edges in one gulp, arrange them into a graph of objects, and walk through them that way?

> 
> 
>>>> That sentence is true.  It is also true if you replace the phrase "the
>>>> DB" with the word OO.

>>
>>> Show me how. I opened my wallet, purchased your book, and found it
>>> wanting and produced a much simpler and flexible payroll example. For
>>> free even. Unlike you, I don't charge for personal subjective
>>> opinions.

>>
>> There's another one of those hidden emotional barbs. You realize of
>> course that you have just promised that you will never write a book.
>
> Not at all. He could instead write a *factual* book.

Ah, a book without opinions. Imagine writing a book on software design that had no opinions.

-- 
Robert C. Martin (Uncle Bob)  | email: unclebob_at_objectmentor.com
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716                  |
Received on Tue Mar 11 2008 - 01:28:34 CET

Original text of this message