Re: What databases have taught me

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Fri, 30 Jun 2006 20:13:51 -0500
Message-ID: <2006063020135127544-unclebob_at_objectmentorcom>


On 2006-06-28 23:45:52 -0500, frebe73_at_gmail.com said:

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

>
> Ok, lets say we want to add a module formatting the report and one
> module doing the "business logic". The formatting module should only
> change if you need to change the format, right? The business module
> should only change if you need to change the business logic, right?
>
> Now we want to add a new atttribute, telephoneno. This new attribute
> should also be printed in the report. Doesn't this change in business
> logic also force the format module to change? The format module may
> change by other reasons than formatting reasons.

Yes, the addition of the new attribute can cause multiple modules to change; but they all change for different reasons. For example, the first release might add new business rules around the phone number, but not necessarily change the existing report. The new reports could come in a subsequent release.

The changes to both modules may need to be done at the same time, but the structure of the software does not demand that they both change at the same time.

-- 
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 Sat Jul 01 2006 - 03:13:51 CEST

Original text of this message