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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

At the end <strong>of</strong> the last chapter, things were in a pretty bad way.<br />

You’d added Mercury Meals’ code into Orion’s Orbits and were<br />

all set to demo things to the CFO when you hit a problem. Well,<br />

actually three problems—and that adds up to one big mess...<br />

> java OrionsOrbits<br />

Adding order...<br />

Title:<br />

Est:<br />

384 Chapter 11<br />

Your system freezes<br />

when you try and<br />

run it...it just stops<br />

doing anything.<br />

Orion’s Orbits is NOT working.<br />

Your customer added three new user stories that relied on some<br />

new code from Mercury Meals. Everything looked good, the<br />

board was balanced and you completed the integration work<br />

when, BOOM!, you ran your code and absolutely nothing<br />

happened. The application just froze...<br />

12<br />

Priority:<br />

Order Regular Meal<br />

10<br />

Title:<br />

Est:<br />

Priority:<br />

Title:<br />

Est:<br />

Priority:<br />

Order vegetarian or vegan meal<br />

20<br />

View all the orders for a flight<br />

4<br />

10<br />

6<br />

// Follows the Singleton design pattern<br />

public class MercuryMeals<br />

{<br />

public MercuryMeals meallythang;<br />

private Order cO;<br />

private String qk = “select * from order-table where keywords like %1;”;<br />

public MercuryMeals() {<br />

}<br />

public MercuryMeals getInstance()<br />

{<br />

}<br />

this.meallythang = new MercuryMeals();<br />

return this.instance;<br />

// TODO Really should document this at some point... TBD<br />

public Order createOrder {<br />

return new Order();}<br />

public MealOption getMealOption(String option)<br />

throws MercuryMealsConnectionException {<br />

}<br />

if (MM.establish().isAnyOptionsForKey(option))<br />

{ return MM.establish.getMealOption(option).[0] };<br />

return null;<br />

// Mercury Meals class continued...<br />

{<br />

public boolean submitOrder(Order cO)<br />

try {<br />

MM mm = MM.establish();<br />

mm.su(this.cO);<br />

catch (Exception e)<br />

{ // write out an error message } return false; }<br />

public Order[] getOrdersThatMatchKeyword(String qk)<br />

}}<br />

Order o = new Order[];<br />

try {<br />

o = MM.establish().find(qk, qk);<br />

} catch (Exception e) {<br />

}<br />

return null;<br />

return o;<br />

throws MercuryMealsConnectionException {<br />

You have a LOT <strong>of</strong> ugly new code.<br />

When you dug into the Mercury Meals code,<br />

you found a ton <strong>of</strong> problems. What’s causing<br />

the problems in Orion’s Orbits, and where<br />

should you start looking?<br />

You have THREE user stories that rely on<br />

your code working.<br />

All <strong>of</strong> this would be bad enough, but there are three user<br />

stories that rely on the Mercury Meals code working, not<br />

just one.<br />

To make matters even worse, the CEO <strong>of</strong> Orion’s Orbits<br />

has talked you up to the CFO, and both are looking<br />

forward to seeing everything working, and soon...<br />

Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!