01.02.2013 Views

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You’ll need to<br />

pull the gift<br />

card from the<br />

database<br />

...save the<br />

order...<br />

...then save the<br />

updated gift<br />

card back out.<br />

}<br />

Getting to Green... again<br />

Now you’ve got a way to isolate the OrderProcessor class from the database.<br />

Implement the processOrder() method using the right database strategy.<br />

// existing code<br />

private DBAccessor dbAccessor;<br />

public void setDBAccessor(DBAccessor accessor) {<br />

dbAccessor = accessor;<br />

}<br />

public Receipt processOrder(OrderInformation orderInfo) {<br />

}<br />

OrderInformation<br />

- customerName: : String<br />

- drinkDescription : String<br />

- giftCardNumber : int<br />

- preferredStoreNumber : int<br />

+ setCustomerName(name : String)<br />

+ setDrinkDescription(desc : String)<br />

+ setGiftCardNumber(gcNum : int)<br />

+ setPreferredStoreNumber(num : int)<br />

+ getCustomerName() : String<br />

+ getDrinkDescription() : String<br />

+ getGiftCardNumber() : int<br />

+ getPreferredStoreNumber() : int<br />

Receipt<br />

- confirmationNumber : int<br />

- pickupTime : Date<br />

- gcBalance : BigDecimal<br />

+ setConfirmationNumber(no : int)<br />

+ setPickupTime(date : Date)<br />

+ setGCBalance(bal : BigDecimal)<br />

+ getConfirmationNumber() : int<br />

+ getPickupTime() : Date<br />

+ getGCBalance() : BigDecimal<br />

Download at WoweBook.Com<br />

test-driven development<br />

This allows the right<br />

database accessor to be<br />

set for order processing.<br />

GiftCard<br />

- activationDate : Date<br />

- expirationDate : Date<br />

- balance : BigDecimal<br />

+ getActivationDate() : Date<br />

+ getExpirationDate() : Date<br />

+ getBalance() : BigDecimal<br />

+ setBalance(BigDecimal) : void<br />

+ equals(object : Object) :boolean<br />

you are here 4 297

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!