This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Think about the following small program with the following Classes. Father, Mother and Son. Father has method provideBread(double money), mother has method buyBread(double money, Son son)and Son has method goToShop(double money). In order for the family to obtain bread, provideBread() is invoked on Father by passing his money, say 10.0. In turn, provideBread() invokes buyBread() on mother, passing the money and the specific son to send to the shop. The mother, as you would imagine, delegates the business of going to the shop to her Son by calling his goToShop() method. Now, on reaching the shop, several things (Exceptions) may happen. For instance, here may be no bread at the shop or the money passed by Father may not be enough. If the exception is that there is no bread at the shop, the son might very well handle it by checking in the next shop without requiring to inform any of his parents of that decision. In this case, Son Handles the exception, say BreadOutOfStockException. If however the money is not enough, the son will need to inform his mother of that fact (in other words, catch the say, MoneyNotEnoughException and instead of handling it, throw it to his mother). Of course the mother may handle the exception herself (if she is not broke, say broke) or "throw" it higherup to the father for him to worry about where to get more money (How to handle the exception).