MVC + RMI

O

oblivion

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
 
O

Oliver Wong

oblivion said:
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?

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
 
O

Oliver Wong

oblivion said:
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
 
O

oblivion

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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,000
Messages
2,570,252
Members
46,848
Latest member
CristineKo

Latest Threads

Top