18 Connie’s <strong>Convenience</strong> <strong>Store</strong> Applying Patterns: Select and Organize Problem-Domain Objects ProblemDomain Cash CashDrawer Cashier Charge Check Item Payment Person Register Sale SaleLineItem Session <strong>Store</strong> TaxCategory Sale SaleLineItem Session Figure 1–8: Select transactions. Payment APPLYING PATTERNS: SELECT AND ORGANIZE PROBLEM-DOMAIN OBJECTS You’ve selected a number of objects (and formed classes of them). Now, take an initial look at some patterns. An object-model pattern is a template of objects with stereotypical responsibilities and interactions; the template may be applied again and again by analogy. Use some patterns, initially, at this point, just to connect some of the pieces together in a meaningful way. You might discover some additional objects along the way, too. Cash Check Charge
Applying Patterns: Select and Organize Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 19 Participant-transaction #3. “Participant-Transaction” Pattern transaction patterns Participant number startDate endDate password authorizationLevel aboutMe howMany howMuch rankTransactions calcOverTransactions isAuthorized calcForMe n 1 Transaction number date time status aboutMe calcForMe rateMe • Typical object interactions howMany —> calcForMe calcOverTransactions —> calcForMe howMuch —> calcForMe rankTransactions —> rateMe • Examples Participant: agent, applicant, buyer, cashier, clerk, client, civilian, customer, dealer, delegate, distributor, donor, employee, investor, manufacturer, member, officer, official, order clerk, owner, participant, policy holder, professional, prospect, recipient, retailer, sales clerk, sales rep, shipper, student, subscriber, supervisor, supplier, suspect, teacher, wholesaler, worker. Transaction: agreement, assignment, authorization, contract, delivery, deposit, incident, inquiry, order, payment, problem, report, purchase, refund, registration, rental, reservation, sale, shift, shipment, subscription, time charge, title, withdrawal. • Combinations actor-participant; participant-transaction; place-transaction; specific item– transaction; transaction–transaction line item; transaction–subsequent transaction. That large, numbered box with a double border is a pattern box. You’ll see these boxes from time-to-time, right when you need them, within the application chapters. The number in the upper left corner is a pattern number; it’s there for easy reference. See Chapter 7, “Strategies and Patterns Handbook,” for more. Session and its participants A session is a transaction object. What are its participants? The participants are a cashier and a register. A cashier starts a session on a specific register at a specific date and time.