Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design patterns used in Swing and RMI API

 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I'm just curious is it true that the Swing API uses MVC pattern internally? I read books and articles that MVC this that in Swing blablabla. Similarly, for RMI, is it using the (Remote) Proxy pattern internally by saying "accessing remote objects as if they are local"?

If this is true, so if we use RMI, does it mean we automatically using Proxy pattern? Same for Swing using MVC pattern?
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K. Tsang wrote:Hi all, I'm just curious is it true that the Swing API uses MVC pattern internally? I read books and articles that MVC this that in Swing blablabla. Similarly, for RMI, is it using the (Remote) Proxy pattern internally by saying "accessing remote objects as if they are local"?

If this is true, so if we use RMI, does it mean we automatically using Proxy pattern? Same for Swing using MVC pattern?


The whole point of MVC is to separate the Model (M), the View (V) and the Controller (C). Because SWING has listener on which you register to listen for actions performed on your View component, it is very MVC.. But, one can easily organize it up incorrectly and deviate from MVC.

The main point of MVC is to dissociate your model from your View. Your model should not know "how" they are displayed. Your model should not directly modify properties in your view. Instead, your view should "observe" the model, be notify of any change and modify itself accordingly.

I don't know if RMI does "exactly" follow the Proxy pattern, I would guess so.. Beside having to handle the extra exception (RemoteException), you do "pretty much" handle local and remote object the same way. I remember being asked this question back in University and I do believe the professor was giving the points for both answers depending on your explanation.

Best of luck
Alex
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic