23.07.2012 Views

Design Patterns Explained

Design Patterns Explained

Design Patterns Explained

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

296 Part V • Handling Variations with <strong>Design</strong> <strong>Patterns</strong><br />

4. Use the rows to<br />

identify rules<br />

A note about customers.<br />

My experience with customers has taught me several things:<br />

• They usually know their problem domain very well (most<br />

know it better than I ever will).<br />

• In general, they do not express things on the conceptual<br />

level, as developers often do. Instead, they talk in specific<br />

cases.<br />

• They often use the term always when they mean usually.<br />

• They often use the term never when they mean seldom.<br />

• They often say they have told me about all of the cases when<br />

in fact they have only told me what usually happens.<br />

The bottom line is that I trust customers to tell me what happens<br />

when I ask specific questions but I do not trust their generalized<br />

answers. I try to interact with them at a very concrete level. Even<br />

those customers who sound like they think in a conceptual way<br />

often do not, but are trying to "help me out."<br />

Now that the concepts are revealed, what should I do with what I<br />

know? How do I begin to move toward implementation?<br />

Look at the matrix in Table 20-6. The first row is labeled "Calculate<br />

freight," and includes "Use UPS rates," "Use Canadian shipper,"<br />

and "Use German shipper." This row represents both<br />

• A general rule to implement "Calculate freight rate"<br />

• The specific set of rules that I must implement— that is, each<br />

shipper I may use in the different countries<br />

In fact, each row represents specific ways of implementing a generalized<br />

concept. Two of the rows (money and dates) may be handled at<br />

the object level. For example, money can be handled with objects

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!