• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

design problems

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have several questions:
(1) I use Facade and MVC design patterns in my client side. The model have an instance of Facade.
Is that right?
(2) Should I declare "throws xxxException" in the Facade and let the model catch it ,or catch it in the Facade?
(3) I have one DataInterface and both remote and local data extends it. Is that right? If I do this,the local data have declare "throws RemoteException" ,I think it may be bad. Need I put the DataInterface in both client and server side?
Thanks
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ray,

(1) I use Facade and MVC design patterns in my client side. The model have an instance of Facade.
Is that right?


Sounds like a reasonable way to do it.

(2) Should I declare "throws xxxException" in the Facade and let the model catch it ,or catch it in the Facade?


That depends.
Is the exception something that the facade can handle itself? In which case you might want to have the facade catch it and handle it.
Is the exception something you want passed to the MVC? You might want to hide an RMI exception by catching it in the facade and then throwing a more general exception up to the MVC.
Is the exception something that the MVC should inform the user about? In which case you might want to just throw it directly.

(3) I have one DataInterface and both remote and local data extends it. Is that right?


This is similar to what I did.

If I do this,the local data have declare "throws RemoteException" ,I think it may be bad.


See my earlier comment about catching a specific exception and throwing a generic exception.
Regards, Andrew
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic