Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

MVC + RMI

Thread view: 
oblivion - 15 Dec 2006 18:03 GMT
Hello!

I am writing simple client-server network game using RMI.
Client side has three classes:
- view: simple GUI
- model: engine, which invokes methods on server
- controller: connecting view with model

Client-server communication uses callback, so server
can invoke methods on client.
When server invokes model method it modify its
fields values. Controller and view don't know that
fields values has been changed.

My question is:
How to immediately notify controller or view about invoking
remote method on model? How to do it in MVC?
Is this possible to bind model's fields with view items?
Is there more suitable design pattern for such an application?

Thanks in advance,
Piotr Piwko
Oliver Wong - 15 Dec 2006 21:08 GMT
> When server invokes model method it modify its
> fields values. Controller and view don't know that
[quoted text clipped - 5 lines]
> Is this possible to bind model's fields with view items?
> Is there more suitable design pattern for such an application?

   MVC is usually coupled with the Observer pattern, where the View is an
observer of the Model. I'm not sure why the controller would need to be
notified of changes in the Model, but if this is a requirement, then I
supposed you could make the Controller an observer of the model too.

   - Oliver
oblivion - 15 Dec 2006 21:37 GMT
Oliver Wong napisal(a):
>     MVC is usually coupled with the Observer pattern, where the View is an
> observer of the Model. I'm not sure why the controller would need to be
> notified of changes in the Model, but if this is a requirement, then I
> supposed you could make the Controller an observer of the model too.
>
>     - Oliver

Thanks, I didn't know about Observer pattern. I'll get it a try ,I
think it's the solution :)
Oliver Wong - 15 Dec 2006 21:10 GMT
> I am writing simple client-server network game using RMI.
> Client side has three classes:
> - view: simple GUI
> - model: engine, which invokes methods on server
> - controller: connecting view with model

   I forgot to mention, unless the Model is located on one computer, and
the Views and Controllers are located on a different one, then the fact that
you're using RMI isn't very relevant to your problem.

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.