Re: What databases have taught me
Date: Tue, 27 Jun 2006 22:57:26 -0700
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:
|A|------->|I| A | |B|
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: unclebob_at_objectmentor.com Object Mentor Inc. | blog: www.butunclebob.com The Agile Transition Experts | web: www.objectmentor.com 800-338-6716 |Received on Wed Jun 28 2006 - 07:57:26 CEST