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.

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 />

Believe it or not, this bracket here<br />

closes the class, but from the poor use <strong>of</strong><br />

indentation, you’d be hard-pressed to be<br />

sure <strong>of</strong> that from looking.<br />

No documentation on any <strong>of</strong> this class’s methods.<br />

Something that described what the methods are<br />

supposed to do would make life a LOT easier.<br />

No wonder the s<strong>of</strong>tware gave no indication whether<br />

it was working or not (except by just hanging...) This<br />

method swallows all exceptions that are raised. This is<br />

a classic exception anti-pattern. If an exception gets<br />

raised, and you can’t deal with it locally, then pass<br />

the exception up to the caller so they can at least<br />

know what went wrong.<br />

the next iteration<br />

The code indentation is still all<br />

over the place. This makes things<br />

very hard to read.<br />

throws MercuryMealsConnectionException {<br />

Hiding exceptions again! The caller <strong>of</strong><br />

this method will never have to handle a<br />

MercuryMealsConnectionException or any other<br />

exception because this method is hiding anything<br />

that goes wrong and just returning null.<br />

Download at WoweBook.Com<br />

Which qk is being used here? This<br />

doesn’t make sense, and might be a bug.<br />

you are here 4 377

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

Saved successfully!

Ooh no, something went wrong!