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.

Establishing Responsibilities for Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 35<br />

#90. “Service as a Question” Strategy establishing responsibilities /<br />

what I do (fundamentals)<br />

• Ask: what questions can an object answer?<br />

• Some good starting words to choose from: has, how many, how much, includes, is.<br />

• Why: stronger encapsulation, better partitioning of services; fewer objects that are mere<br />

data holders.<br />

One useful cashier service answers the question “Is authorized?” Write it down like<br />

this:<br />

– is authorized.<br />

What’s another?<br />

#91. “Service as a Verb” Strategy establishing responsibilities /<br />

what I do (fundamentals)<br />

• Some good service name verbs to choose from:<br />

activate (initialize, initiate, open, start)<br />

answer (reply, respond)<br />

assess (appraise, assay, evaluate, value)<br />

calculate (compute, count, estimate, rate, tally)<br />

deactivate (close, end, shut down, terminate)<br />

determine (decide, figure out, observe, resolve)<br />

find (get, look for, pinpoint)<br />

measure (bound, gauge, limit)<br />

monitor (conduct, direct, manage, observe, operate, supervise, watch)<br />

qualify (characterize, differentiate, discriminate, distinguish, mark)<br />

select (choose, cull, elect, opt for, pick).<br />

• Append “over interval” for services that apply to different time intervals.<br />

Another useful cashier service is:<br />

– assess performance.<br />

If a service is something that could be applied over many intervals of time, add<br />

“over interval” to the service name (Figure 1–23).<br />

Revised, a cashier’s services are:<br />

– is authorized<br />

– assess performance over interval.

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

Saved successfully!

Ooh no, something went wrong!