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> 31<br />
What does a person object do?<br />
The same basics that every object does:<br />
– get . . . an attribute value<br />
– set . . . an attribute value<br />
– add . . . a connection to another object<br />
– remove . . . a connection to another object<br />
– delete . . . that object.<br />
What does the person class itself do? The same basics that every class does:<br />
– create (and initialize) . . . a new object.<br />
You don’t need these basic services in your object model. You will find occasional<br />
use for them within a scenario view.<br />
What if you did put them everywhere? You’d have to add a half dozen labels to<br />
every class with objects. Ugh! That’s a lot of added model complexity, with little gain in<br />
model effectiveness. You see, notation is not free; every piece must pay its way, improving<br />
understanding enough to warrant the added complexity. As one person so eloquently<br />
put it:<br />
“The ability to simplify means to eliminate the unnecessary<br />
so that the necessary may speak.”<br />
—Hans Hoffman<br />
What about for person and participant?<br />
#94. “Establish Actor and Participant establishing responsibilities /<br />
Services” Strategy what I do (pattern players)<br />
• For an actor or participant, include: calculate for me, rate me, is .<br />
• For an actor as a collection, include: how many, how much, rank participants, calculate<br />
over participants (plus services to enforce business rules across that collection).<br />
• For a participant as a collection, include: how many, how much, rank transactions,<br />
calculate over transactions (plus services to enforce business rules across that<br />
collection).<br />
Usually, the more interesting “what I do” behavior is done by the participant objects.