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.

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

Participant: cashier<br />

Establish responsibilities: “what I know.”<br />

#50. “Select Attributes from Actual Ones” Strategy establishing responsibilities /<br />

what I know (fundamentals)<br />

• This is an aspect of a software object coming to life: “I know selective things that describe<br />

the actual object that I’m an abstraction of.”<br />

• Select the attributes for your software objects, taken from the abundance of the attributes<br />

that could be used to describe a corresponding actual (real-world) object.<br />

• Consider attributes from a broad-sweeping perspective; then work your way into the<br />

specific ones you need. Look at attributes in general, in this domain, and ultimately just<br />

within this system’s responsibilities.<br />

Okay. What do you need to know about each cashier?<br />

– number<br />

– password<br />

– authorization level<br />

and, as discussed earlier in the chapter, an attribute to distinguish that one session has<br />

special meaning, namely:<br />

– current session.<br />

Model it (Figure 1–21):<br />

Cashier<br />

number<br />

password<br />

authorizationLevel<br />

currentSession<br />

Figure 1–21: Cashier: “what I know.”<br />

Establish responsibilities: “who I know.”<br />

Who does a cashier object know?<br />

It knows its sessions, the ones it participates in. (And each session knows its<br />

cashier.)<br />

It knows its corresponding person object, too (Figure 1–22):

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

Saved successfully!

Ooh no, something went wrong!