Re: What databases have taught me

From: Robert Martin <>
Date: Tue, 27 Jun 2006 22:57:26 -0700
Message-ID: <2006062722572643658-unclebob_at_objectmentorcom>

On 2006-06-23 07:51:50 -0700, Kenneth Downs <knode.wants.this_at_see.sigblock> said:

> Is there a rational basis for deciding where to put the logic?

Yes. It's called "The Single Resonsibility Principle" (SRP). This principle says that a software module should have one, and only one reason to change. For example, a module that contains business rules should not also contain report formatting. Business rules and report formatting change for completely different reasons, and should therefore be isolated in completely different modules.

Then there's "The Dependency Inversion Principle" (DIP) which says that the target of a dependency should be an abstraction. So, instead of this:


Where module A depends on module B, we want this:


Where A depends on an abstract interface, and B implements that abstract interface.

If you follow these two principle you will focus change into modules, and prevent those changes from leaking out into other modules.

Robert C. Martin (Uncle Bob)  | email:
Object Mentor Inc.            | blog:
The Agile Transition Experts  | web:
800-338-6716                  |
Received on Wed Jun 28 2006 - 07:57:26 CEST

Original text of this message