20.02.2013 Views

Connie's Convenience Store - About Peter Coad

Connie's Convenience Store - About Peter Coad

Connie's Convenience Store - About Peter Coad

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

16 Connie’s <strong>Convenience</strong> <strong>Store</strong> Selecting Problem-Domain Objects<br />

Sale<br />

One of the transactions is sale. Check it out.<br />

(<strong>Peter</strong>) Connie, what are the main things you do with a customer?<br />

(Connie) We sell items.<br />

(<strong>Peter</strong>) Do you have a special name for that?<br />

(Connie) A special name? “Sale.” (Now isn’t that special.)<br />

(<strong>Peter</strong>) Does it include only items you sell to a customer?<br />

(Connie) Now that you mention it, a sale may include both sales and returns.<br />

Hold it! The domain vocabulary is “sale.” Someone on our team might argue that<br />

you should use a more accurate term, “sales transaction.” Advice? Don’t do it. Key<br />

point: don’t ever change domain vocabulary unless your customer sees the need for and<br />

wants to make the change (otherwise you’ll be forever mapping her words to your<br />

words; that’s both counterproductive and a real nuisance).<br />

Most transactions have parts, called transaction line items. A sale is no exception.<br />

A sale is a collection of some number of sale line items. Add the classes: sale and sale<br />

line item (Fig. 1-8).<br />

Kinds of sales<br />

#34. “Select Kinds of Objects” Strategy selecting objects (kinds of objects)<br />

• Use generalization-specialization (gen-spec) to find additional classes.<br />

Look at each class as a generalization. Name its specializations, ones that fit with<br />

system objectives.<br />

Look at each specialization. Name its generalizations, ones that fit within system<br />

objectives.<br />

• Use gen-spec for domain-based reuse within an application; use configuration<br />

management for reuse across multiple applications, even multiple problem domains.<br />

• Use gen-spec to show domain-based “what’s the same, what’s different,” within an<br />

application.<br />

• Examples: equipment, kinds of equipment; participants, kinds of participants;<br />

transactions, kinds of transactions.<br />

Consider the kinds of sales:<br />

– sales, returns.<br />

Do you need to distinguish between a sale and a return?<br />

(<strong>Peter</strong>) What’s the difference between a sale and a return?<br />

(Connie) The only difference is whether the amount is positive or negative.<br />

You don’t need to add classes for both “sale” and “return.” At this point, the system’s<br />

responsibilities for them appear to be identical. The only difference is whether the<br />

amount is positive or negative.

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

Saved successfully!

Ooh no, something went wrong!