• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MVC: Model notifying View

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

understanding one major part of the MVC pattern, that views register to the model and as soon as the model changes, the model notifies all registered views -> Observer Pattern.
Now I am wondering how this can happen in a 3 tier architecture. I know there is such thing as MVC2 for Web based apps with JSPs as view, a servlet as controller and EJBs as the model. But how will the MVC pattern work in a Swing based app with the model being remote EJBs? How can a view in such a scenario register to the model and how will the (remote EJB) model be able to notify chances to the registered views?

Any ideas are welcome!

D.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are a couple ways to look at this.

One is to say the Swing client has the complete MVC inside it, and remote communications are something the model does when it has to. That makes remote communications unrelated to the client MVC. Oh, I almost passed up a chance to say "orthogonal". The server can have another complete MVC model inside as well, if you like.

It's more complex to imagine remote communications between MVC components. You could try to just ignore the remote aspect and have the components talk to each other as usual. For server to talk to client asynchronously (say as a result of a server event, not a client request) it would have to have a socket or some connection to push data. Unfortunately, ignoring the remote aspect leads us to design overly busy network communications, so we probably don't want to go there.

I'd love to make up a third answer that perfectly balances all your concerns, but I have to go watch a movie with the wife. And I don't know one. Did those thoughts mesh with what you're trying to do?
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic