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.
Establishing Responsibilities for Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 37<br />
More importantly, a store object gives you a place to put those calculations that<br />
apply across a collection of what a store contains: registers, items, and cashiers.<br />
#102. “Service across a Collection” Strategy establishing responsibilities /<br />
what I do (where to put)<br />
• Service across a collection of objects?<br />
Add a service to a collection object, an object that knows and does things across that<br />
collection.<br />
Let each worker within a collection do its fair share—as much as it can, based upon<br />
what it knows.<br />
• Be sure the collection does just those things that apply across a collection; makes its<br />
workers do as much work as they know enough to accomplish.<br />
• Across its workers: enforce business rules that may apply to its participation.<br />
Establish responsibilities: “what I know.”<br />
#53. “Establish Place Attributes” Strategy establishing responsibilities /<br />
what I know (pattern players)<br />
• For location, include: number, name, address (perhaps latitude, longitude, altitude).<br />
Just include the name of the store; that’s enough for now.<br />
– name.<br />
Establish responsibilities: “who I know.”<br />
#75. “Establish Place Object establishing responsibilities /<br />
Connections” Strategy who I know (pattern players)<br />
• For a location, include object connections to objects which come to rest at a location . . .<br />
or are contained by a location.<br />
• For a location, include object connections to transaction objects, to show that location’s<br />
participation in that transaction.<br />
Who does a store object know? A store object, as a container, knows its contents:<br />
– registers (zero or more)<br />
– items (zero or more)<br />
– cashiers (zero or more).