Re: Exception handling and encapsulation
Thanks everyone who has replied to my post! Sorry I wasn't responsive
over the last few week cuz I was in exams.
In summary, the responses to my OP fall into two catagories:
1) Exceptions are better handled locally. If they can't be handled
locally, much less can the rest of the higher level code deal with those
so the only thing they can and should do is to release a diagnostic
message (error, logging, etc) by using some sort of polymorphism in
2) Exceptions are to be propagated to the highest user-interface level
(that is if the program actually has a UI, of course) so the users are
left to deal with those.
Furthermore, the above two are not completely orthogonal.
My concern, however, is not much of a functional one but rather an
effort to keep a consistent level of abstraction across each layer of
code, if that makes any sense to you. The impression I have so far is,
my concern is less relevant than what I have pictured before.
Drop a word if you think I understood wrong.