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

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Tue, 13 Jun 2006 12:16:37 +0200
Message-ID: <2006061312163727544-unclebob_at_objectmentorcom>


On 2006-06-02 01:18:35 +0200, "Mikito Harakiri" <mikharakiri_nospaum_at_yahoo.com> said:

>> An application should have its SQL statements in only a few modules, and
>> all others should be SQL-free.

>
> Why? The SQL statements should be included into those modules that
> query/modify information from database. Would it be a few or many
> entirely depends on the application functionality.

Functionality can be split between many modules. Given a particular functionality, part of it will be SQL related, and part of it will not.  We would like those two parts to be separated at the source code level, with the dependencies pointing AWAY from the SQL modules. This allows us to change out the data management technology (if not the theory), and also test the application code without running the DB.
>

>> Note in my statement, you can replace SQL with GUI, XML, ORB, etc, to
>> generally the same effect. The point of modules is to isolate and
>> encapsulate.

>
> I don't challenge your goal, but relational model abstractions are too
> sophisticated to give up to such primitive methods.

Nobody is talking about giving anything up. The position of a line of code does not limit it's power. The fact that we want the SQL in source modules that are independent, does not mean that they can't be used all through the application.

> Striving to make
> your application database agnostic results in the flaws which expose
> designers data management ignorance.

I disagree. Striving to separate your application into database dependent and database independent partitions enhances flexibility and testability, without reducing power.

-- 
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 Jun 13 2006 - 12:16:37 CEST

Original text of this message