15.01.2013 Views

Foundations of Programming - Karl Seguin

Foundations of Programming - Karl Seguin

Foundations of Programming - Karl Seguin

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.

Chapter 8 - Back to Basics: Exceptions<br />

In This Chapter<br />

It can take quite a fundamental shift in perspective to appreciate everything exceptions have to <strong>of</strong>fer.<br />

Exceptions aren't something to be feared or protected against, but rather vital information about the<br />

health <strong>of</strong> your system. Don't swallow exceptions. Don't catch exceptions unless you can actually handle<br />

them. Equally important is to make use <strong>of</strong> built-in, or your own exceptions when unexpected things<br />

happen within your code. You may even expand this pattern for any method that fails to do what it says<br />

it will. Finally, exceptions are a part <strong>of</strong> the business you are modeling. As such, exceptions aren't only<br />

useful for operational purposes but should also be part <strong>of</strong> your overall domain model.<br />

<strong>Foundations</strong> <strong>of</strong> <strong>Programming</strong> Copyright © <strong>Karl</strong> <strong>Seguin</strong> www.codebetter.com<br />

72

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

Saved successfully!

Ooh no, something went wrong!