Connie's Convenience Store - About Peter Coad
Connie's Convenience Store - About Peter Coad
Connie's Convenience Store - About Peter Coad
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Selecting Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 9<br />
Cashier, head cashier<br />
Cashier objects are a must; the system will assess each cashier’s performance.<br />
What about head cashier? What should you do here?<br />
One choice: you could model it as another kind of participant. In fact, you could<br />
model a head cashier as a special kind of, a specialization of, a cashier. When would<br />
you do this?<br />
Check out potential attributes.<br />
#68. “Partially Applicable Attribute” Strategy establishing responsibilities /<br />
what I know (consider and challenge)<br />
• Attribute that applies only to certain objects in a class?<br />
• Do you have an attribute which applies only to certain kinds of objects?<br />
• Do you have an attribute that may have the value “not applicable”?<br />
• If so, factor out the specialized attribute into a specialization class.<br />
Check out potential services.<br />
#121. “Partially Applicable Service” Strategy establishing responsibilities /<br />
what I do (consider and challenge)<br />
• Do you have a service that applies only to certain objects in a class?<br />
• Do you have a service that applies only to certain kinds of objects?<br />
• Do you have a service which tests for what kind it is, and then acts accordingly?<br />
• If so, factor out the specialized service into a specialization class.<br />
Add another participant class? Only if a head cashier object knows or does something<br />
different from what a cashier object knows or does. (Hmmm. No difference here.)<br />
Another choice: you could model it along with some other participant. Express<br />
simple variation with attribute values. In this case, you could treat a head cashier as a<br />
cashier with a greater level of authorization. The only difference is the value of its authorization<br />
level. This second choice makes sense here: at this point, just a difference in<br />
value seems to be enough.