AN OO DESIGN EXAMPLE

Similar documents
Object-Oriented Analysis and Design, Part 2 by Alistair Cockburn, with C++ code by Chuck Allison

Aulika Top HSC High speed cappuccino. Saeco Vending & Professional

Your high capacity bean to cup coffee solution!

enjoy the experience

Your high capacity bean to cup coffee solution!

Your ground coffee solution!

Take Your Coffee Experience to the Next Level With Cafection s New 29 Bean to Cup Solution!

Quality and variety. To each his own. To each the best. Macchiavalley keeps the quality of the up to 21 programmable. constantly on a high level.

DISCOVER THE POWER OF SIMPLICITY

S uper A utomatic C offee M achines

HOW TO OPEN A BUBBLE TEA SHOP

Manufactured in Des Moines, IA U.S.A. Since 1931

DISCOVER THE POWER OF SIMPLICITY

LIFE COMES IN MANY FLAVORS

Mini Project 3: Fermentation, Due Monday, October 29. For this Mini Project, please make sure you hand in the following, and only the following:

NOW MEETS & EXCEEDS NSF 4 REQUIREMENTS. Take Your Coffee Experience to the Next Level with this Enhanced 29 Bean to Cup Solution! for food and safety

The Keurig B3000se: This, our largest and most advanced brewing system,

Take Your Coffee Experience to the Next Level With Cafection s New 29 Bean to Cup Solution! *Images may vary from actual product.

Networking. Optimisation. Control. WMF Coffee Machines. Digital Solutions 2017.

12% Baking Mad. Page views increased by. Ridgeway. FOOD AND DRINK

Roux Bot Home Cooker. UC Santa Cruz, Baskin Engineering Senior Design Project 2015

Given a realistic scenario depicting a new site install, the learner will be able to install and setup the brewer for retail turnover without error.

User Manual. Coffee recipes included

Armonia Smart. Quick Start Guide MACHINE DESCRIPTION STARTING UP

NEVA DUO NEVA BEAN TO CUP NEVA 4 NEVA 3. Neva. Beverage Systems By Coffetek

MODELS SHOWN: BICM24CS BUILT-IN COFFEE MACHINE AND WDC30JP WARMING DRAWER

UNIVERSITY OF LINCOLN JOB DESCRIPTION CONTEXT

Cafeteria Ordering System, Release 1.0

2016 Gourmia The Steelstone Group Brooklyn, NY

NEVA DUO NEVA 3. Neva. Beverage Systems. By Coffetek

Franke Coffee Systems. Saphira: The art of enjoying coffee. Franke Coffee Systems. The art of excellent coffeemaking

Beer Hardware, Systems and Delivery

WE GRANTED YOUR FIRST WISH: THE BEST QUALITY IN A TOUCH

Frequently Asked Questions

Hassle free mixology. You re in the right place. We understand your market. Everything you need to maximise your profits

Melitta Cafina XT6. Coffee perfection in every cup. Made in Switzerland. Melitta Professional Coffee Solutions

Saeco Idea Restyle Semiautomatic table top for mid to large offices and ho.re.ca. applications

WMF 1200S. Operating & cleaning instructions Malvern Road Glen Iris VIC 3146 ph: fax:

EXPOBAR OFFICE MACHINES

Just Dunkin'?: Morning fast-food chain considers name change

Northern Vending Company

Table of Contents. Toast Inc. 2

Micro Casa Semiautomatica

TEA INTERACTION DESIGN

Using your Grinder: Fig.1 Fig. 2

Contents. Objective. Summary

Central Purchasing 213 South Oliver Drive Aztec, New Mexico (505)

1-800 Vending Machine Manual - TVF - Files Recently Uploaded; 0 user(s) are online (in the past 15 minutes) 0 members, 0 guests, 0 anonymous users

Welcome. ETNA Coffee Technologies Company presentation

Unit of competency Content Activity. Element 1: Organise coffee workstation n/a n/a. Element 2: Select and grind coffee beans n/a n/a

Dunkin' Donuts mulls name change, promises it's still doughnut company

Barista at a Glance BASIS International Ltd.

The new standard for tabletop coffee machines

Given a realistic scenario depicting a new site install, the learner will be able to install and setup the brewer for retail turnover without error.

Franke Coffee Systems. Franke Coffee Machines. Flair: The charming way of enjoying coffee.

Franke Coffee Systems. Franke Coffee Machines. Flair: The charming way of enjoying coffee.

AGREEMENT n LLP-LDV-TOI-10-IT-538 UNITS FRAMEWORK ABOUT THE MAITRE QUALIFICATION

Quick Reference Guide

Integrating Point of Sale Technology with Guest Management Insights

ProStart Level 1 Chapter 10 Serving Your Guest 1 point per question unless noted otherwise Points possible 132

Dunkin' makes the dough from more than just a doughnuts menu

Franke Coffee Systems Evolution: The ultimate stage in coffeemaking competence.

ALHA CONCESSION STAND GUIDE BOOK

Jura Capresso F9 Repair Manual

Coffee Prime. The first choice for connoisseurs and money-conscious consumers

What's in the box 2 ENGLISH

CafeRomatica NICR7.. Fully automatic coffee centre Operating Instructions and Useful Tips. A passion for coffee.

GAGGIA ANIMA DELUXE FULL AUTOMATIC MACHINE

OPERATING MANUAL. Sample PRO 100 Series. Electric Heating. Applies to Versions: SPE1*, SPE2, SPE4, SPE6

TITBIT WHITEPAPER TITBIT HELPS ORBIT CAFÉ INCREASE CHECK AVERAGES BY 20% AND IMPROVE EFFICIENCY AT REDUCED COST

F R E S H C U P. Single Serve Automatic Eject Pod System by:

Jetinno,a science and technology company concentrating on innovating, manufacturing and providing service for commercial coffee equipment.

SCAE CDS:! Introduction to coffee! The start of your journey into the SCAE Coffee Diploma System, for anyone with an interest in coffee!

Quick Guide Cappuccinatore

For Beer with Character

R A W E D U C A T I O N T R A I N I N G C O U R S E S. w w w. r a w c o f f e e c o m p a n y. c o m

Coffee Machines. Boring? Perfection!

P L A T I N U M ESPRESSO

Answer 1: Although Janine s uncle never graduated from high school, he started his own landscaping company at sixteen.

PUBLICIMBALI /2016 FEME Gruppo Cimbali S.p.A. Via Manzoni, Binasco (MI) Italy Tel

Table of Contents Opening Duties Stocking the Equipment Turning on the Equipment Stocking the Food Preparation

TOMAHAWK HOCKEY ASSOCIATION Season CONCESSION STAND HANDBOOK

Welcome to Coffee Planet

MTN Products. AquaCafé r (Touch Capsules) Installation & Operations Manual

Economic Census Overview and Exercises

Lusso / Espresso Si' Models:PL-16 PAB-16. Made In Italy

Barista Connect. Rooibos Espresso. March Corporate Marketing. New! Lunch Combo Launching April 10 th ROOIBOS ESPRESSO CAMPAIGN

Melitta Cafina XT8. Enjoyment on a grand scale. Melitta Professional Coffee Solutions

30% milk. High quality frothed milk made easy. of all coffees ordered use

Get Started. Better Everyday ECAM23260

CHOCOLINO CAFÉLINO USER MANUAL UM_EN. Part No.: _01

Luce zero is not just one machine, but all the machines it can become.

JBL Resorts. Joe Bolton, Ku ulei Belveal, Brynn Alcain

Stocking the Buffet. Buffet Set Up: Always place buffet products according to the current Buffet Setup, shown below. GUEST FLOW. Choice C/D.

Maintenance guide. Maintenance Guide 1

The Coffee Expert. Sielissimo TableTop series. Hot drinks. vending machine. Sielissimo TableTop

For a relaxing and uncomplicated vacation in Interlaken, we have summarized the most important information about our hotel for you here.

DeskTop Ordering. Test Beginning November 17 th

Perfect Italian espresso coffee. Smooth. Fragrant. Intense. For everyone.

What Is This Module About?

Transcription:

CS2530 INTERMEDIATE COMPUTING 10/18/2017 FALL 2017 MICHAEL J. HOLMES UNIVERSITY OF NORTHERN IOWA AN OO DESIGN EXAMPLE Adapted From: Coffee Machine Design Problem By Alistair Cockburn http://alistair.cockburn.us/searchtitles?for=coffee machine 1

THE COFFEE MACHINE PROBLEM We are contractors who just won a bid to design a custom coffee vending machine for the employees of Acme Fijet Works to use on their lunch and coffee breaks. Arnold, the owner of Acme Fijet Works, like the common software designer, eschews standard solutions. He wants his own, custom design. He is, however, a cheapskate. Arnold tells us he wants a simple machine. All he wants is a machine that serves coffee for 35 cents, with or without sugar and creamer. That s all. He expects us to be able to put this little machine together quickly and for little cost. THE COFFEE MACHINE PROBLEM We get together and decide there will be: Cashbox Coin slot Coin return Coin return lever Front Panel Black With Cream Black with Sugar With Cream and Sugar Mixer Array of Dispensers Cup dispenser Coffee powder dispenser Sugar dispenser Creamer dispenser Water dispenser Now, design the program that runs the machine using objects. Start with the classes above, what are their responsibilities, how do they collaborate to deliver the simple service? 2

THE COFFEE MACHINE PROBLEM Our design needs to meet the following scenarios: 1. Kim puts in a quarter and a dime and then selects a coffee. 2. Kim puts two quarters in and then selects a coffee. 3. Kim puts in a quarter, then pushes the coin return lever. 4. Kim puts in a two quarters, then walks away from the machine and forgets to come back. 5. Kim buys two coffees, white with sugar. The sugar dispenser runs out of sugar after the first. A TYPICAL FIRST COFFEE MACHINE DESIGN Cash Box Knows amount of money put in. Gives change. Knows the price of coffee. Turns the Front Panel on and off. Front Panel Captures the selection Knows what to mix in each. Tells the mixer what to mix. Mixer Instructs the dispensers to dispense some amount of each product. Dispensers Knows how to dispense a fixed amount. Knows when it is empty. (cup, coffee powder, sugar, creamer, water) 3

OBJECT DIAGRAM FOR THE DESIGN SEQUENCE DIAGRAM FOR THE DESIGN 4

REDESIGNING THE COFFEE MACHINE Arnold has another bright idea. After five machines are installed and have been operating for a while, Arnold comes along and says, "I would like to add chicken soup, at a price of 25 cents, to every machine. Change the software." We modify the hardware to include one more button for chicken soup and one more dispenser for the soup mix. How do we change the software design? MODIFIED COFFEE MACHINE DESIGN Cash Box Knows amount of money put in. Gives change. Knows the price of coffee. Turns the Front Panel on and off. Answers how much money has been put in. Front Panel Captures the selection Knows the price and recipe for each selection. Asks the Cash Box how much money was put in. Tells the mixer what to mix. Mixer Instructs the dispensers to dispense some amount of each product. Dispensers Knows how to dispense a fixed amount. Knows when it is empty. (cup, coffee powder, sugar, creamer, water, soup mix) 5

UPDATED OBJECT DIAGRAM FOR THE DESIGN UPDATED SEQUENCE DIAGRAM 6

CHANGING SOFTWARE REQUIREMENTS Arnold (our boss) changed the requirements of our application after we wrote our program. This is typically what happens. In fact, your career depends on it! Users expect that a simple change for them is a simple change in the software. Knowing that requirements will change is an incentive to create software that can be flexibly enhanced. A good OO design can aid in flexibility by creating small cohesive objects that encapsulate the data where we need it and abstract the details. ARNOLD IS BAAACK! In a few weeks, Arnold returns with a brilliant idea. He has heard that some companies use their employee badges to directly debit the cost of coffee purchases from their employees' paychecks. Arnold's employees already have badges, so he thinks this should be a simple change to the system. And he hates to be behind the curve. He modifies the hardware to include a badge reader and network connection to the payroll system. How do we change our design? 7

MODIFIED COFFEE MACHINE DESIGN Cash Box Knows amount of money put in. Gives change. Accepts cash or charge. Turns the Front Panel on and off. Answers how much money has been put in. Answers whether a given amount of credit is available. Front Panel Captures the selection Knows the price and recipe for each selection. Asks the Cash Box how much money was put in. Asks the Cash Box if sufficient credit is available. Tells the mixer what to mix. Mixer Instructs the dispensers to dispense some amount of each product. Dispensers Knows how to dispense a fixed amount. Knows when it is empty. (cup, coffee powder, sugar, creamer, water, soup mix) COMMENTS ON REDESIGN Our initial design broke the rules of cohesiveness. The FrontPanel class was doing too much. It knew the price and was validating the costs. In this redesign we had to correct that and move the knowledge of the prices to the cash box. The FrontPanel did not need to know how much money was put in, but only that enough money had been put in. The CashBox is now managing all of the details about payments. This also allows for only one object to interact with the payroll system. 8

UPDATED OBJECT DIAGRAM FOR THE DESIGN UPDATED SEQUNCE DIAGRAM FOR THE DESIGN 9

NOT AGAIN. People are starting to buy lattes instead of his coffees. Arnold wants the machine modified just slightly, so that he can create a drink of the week. He wants to be able to add new drinks and change prices anytime, to match his competition. He wants to be able to add espresso, cappuccino, hot chocolate, latte, choco-latte, steamed milk in short, anything he can mix together. How do we change our design? MODIFIED COFFEE MACHINE DESIGN Cash Box Knows amount of money put in. Gives change. Accepts cash or charge. Turns the Front Panel on and off. Answers whether a given amount of credit is available. Product Selector Captures the selection. Knows products. Asks the Cash Box if sufficient credit is available. Manages Cash Box and mixer to validate and produce the drink. Product Knows its own price and recipe. Mixer Instructs the dispensers to dispense some amount of each product. Recipe Knows the quantity and sequence of ingredients. Dispenser Register Knows the dispensers Front Panel Dispensers Knows how to dispense a fixed amount. Knows when it is empty. 10

COMMENTS ON REDESIGN Our initial design broke the rules of cohesiveness. The FrontPanel class was still doing too much. In this redesign we removed the knowledge of the recipes. UPDATED OBJECT DIAGRAM FOR THE DESIGN 11

UPDATED SEQUENCE DIAGRAM FOR THE DESIGN NOTES ON FINAL DESIGN Allows for change: Can accommodate new products easily. Products can be modified easily for price and recipe. The product object is passed around the other classes, carrying the required information with it. Each object has a cohesive, small set of responsibilities. 12