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

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Tue, 20 Jun 2006 13:06:53 -0400
Message-ID: <2006062013065380278-unclebob_at_objectmentorcom>


On 2006-06-13 07:25:14 -0400, "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM_at_xs4all.nl> said:

> Robert Martin wrote:

>>
>> 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)|

>
> erm, shouldn't that arrow be in the opposite direction?

No! This is called "Dependency Inversion" (See: http://www.objectmentor.com/resources/articles/dip.pdf)

The App modules define interfaces that the SQL modules implement. The source code has no dependency that goes from the App Modules to the Sql Modules. The calling pathway is set up at runtime by main (or something called by main). Main does this by establishing the pointers within the interfaces of the App modules to point to the implementations within the SQL modules.

-- 
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 20 2006 - 19:06:53 CEST

Original text of this message