mvc design doubts

hi,
I made a gui app based on mvc pattern.I came out as below.Here ,I am
using a SimpleExceptionHandler to handle any exceptions occurring in
the model.This should show the user some appropriate error messages if
any error occurs during processing.In order to do this ,I had to make
the SimpleExceptionHandler become aware of the view and then set the
exceptionhandler in the model.
Here ,I am beginning to doubt if this is the correct way.Am I mixing
up the mvc pattern by letting exception handler beome aware of the
view .Setting the exception handler inside the model too looks
suspicious..
I don't see how else I can let the user know about errors occurred
during processing (inside the model).I considered letting exceptions
bubble to the top level method and returning message from exception to
the user.But that too looks ugly.
If someone can suggest an alternative, it would be great.I am posting
code snippets below.Please let me know what you think.

»If your writing is semi-literate, ungrammatical, and
riddled with misspellings, many hackers (including
myself) will tend to ignore you. While sloppy writing
does not invariably mean sloppy thinking, we've
generally found the correlation to be strong -- and we
have no use for sloppy thinkers. If you can't yet write
competently, learn to.«

The messages that the model processes all were sent by the
controller. So, when an exception occurs during such a
process, the model can just let it rise to the controller
(that is, the model does not catch any exception and just
declares methods as »throws«, or, it only catches to convert
exceptions and then re-throws. It also might report errors
by return values).

The controller then knows what went wrong and then can react
in any way it wants, because the controller knows both the
model and the view. So it could, for example, display an
error message using the view, or terminate the whole process
in the case of a »fatal« error.

Ian Shef wrote:
>> Are you talking about some different Observable ?
>>
>> The Observable that I know is java.util.Observable and is a concrete class,
>> not an interface.
>>
>> You can extend java.util.Observable, but you can't implement it.
>> Typo, perhaps?

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!