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 11:31:09 +0200
Message-ID: <2006061311310975249-unclebob_at_objectmentorcom>


On 2006-06-01 23:09:37 +0200, Bob Badour <bbadour_at_pei.sympatico.ca> said:

> phlip wrote:

>>
>> An application should have its SQL statements in only a few modules, and
>> all others should be SQL-free.
>>
>> 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.
>>
>> Is that so hard?

>
> Define: few

The best answer is "one". We would like all the SQL to be placed in one module, or one group of modules that are all related. More importantly we want that module (or that group of modules) to be independent. No other modules in the system should know that it (they) exist(s). All dependencies point AWAY from the SQL modules.

    |App Modules|<------|SQL MODULE(S)|

This means that the SQL modules can be modified or replaced without affecting the application at all.

This kind of dependency management and detail isolation is the essense of object oriented design.

-- 
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 - 11:31:09 CEST

Original text of this message