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.
Applying Patterns: Select and Organize Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 21<br />
object methods continue that tradition; that’s not enough. Here, you are working with<br />
objects. For each object, you consider “what I know; who I know; what I do.” The first<br />
is represented by attributes; the second is represented by object connections; the third is<br />
represented by services. Constraints on “who I know” belong next to the object being<br />
constrained. That’s the convention used here. It better supports “object think.”<br />
By placing the constraint next to the object being constrained, each object’s responsibilities<br />
for “who I know” comes through much more clearly.<br />
#73. “Show Who I Know” Strategy establishing responsibilities /<br />
who I know (fundamentals)<br />
• Show “who I know” graphically, with an object connection.<br />
Include constraints, placed next to each object being constrained: 1 0-1 n 1-n<br />
ordered n [XOR A] 1 [OR B] 2 [C] ordered n all<br />
“n” is the same thing as “0-n” (it’s just easier to write it as “n”).<br />
A constraint indicates that an object has no need to know the other objects<br />
(this may occur, notably for a part in an aggregate).<br />
ordered n an ordered collection of some number of connections<br />
[XOR A] 1 indicates an exclusive or, pertaining to all object connections labeled<br />
with the same tag (in this example the tag is “A”). Place whatever constraint<br />
applies to the right of the brackets, e.g., [XOR A] 1.<br />
[OR B] 2 two connections, selected from the connections labeled “B”.<br />
[C] ordered n an ordered collection of some number of connections (any connection<br />
from that object that is labeled “C”).<br />
• Or show “who I know” textually, with an attribute.<br />
Use this format whenever an object connection spans across model components — or<br />
any other time that an object connection would be cumbersome, visually.<br />
For a textual representation, use this format:<br />
“”<br />
Make it singular or plural, reflecting the number of objects that the object may<br />
know.<br />
Another example: a cashier object knows about its corresponding session object<br />
(the current one), as well as some number of session objects (one for each and every<br />
time the cashier logs onto the system). This is a common situation in life: “I know<br />
many, yet one is most important to me right now.” What can you do about it? Use both a<br />
“current session” attribute and a cashier-session object connection.<br />
Place-transaction<br />
A store is a place where a sale happens. It’s an instance of place-transaction.