MVC + RMI

Discussion in 'Java' started by oblivion, Dec 15, 2006.

  1. oblivion

    oblivion Guest

    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
     
    oblivion, Dec 15, 2006
    #1
    1. Advertising

  2. oblivion

    Oliver Wong Guest

    "oblivion" <> wrote in message
    news:...
    >
    > 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
     
    Oliver Wong, Dec 15, 2006
    #2
    1. Advertising

  3. oblivion

    Oliver Wong Guest

    "oblivion" <> wrote in message
    news:...
    > 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
     
    Oliver Wong, Dec 15, 2006
    #3
  4. oblivion

    oblivion Guest

    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 :)
     
    oblivion, Dec 15, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Buu Nguyen

    RMI, JINI or RMI/IIOP

    Buu Nguyen, Aug 25, 2004, in forum: Java
    Replies:
    1
    Views:
    568
    Sudsy
    Aug 25, 2004
  2. JScoobyCed

    RMI Vs RMI over IIOP

    JScoobyCed, Jan 28, 2005, in forum: Java
    Replies:
    1
    Views:
    744
    Dag Sunde
    Jan 28, 2005
  3. rmn190
    Replies:
    2
    Views:
    2,368
    Arne Vajhøj
    Jan 10, 2008
  4. Paulo
    Replies:
    3
    Views:
    482
    Peter Bromberg [C# MVP]
    Dec 4, 2008
  5. Crazy Cat
    Replies:
    1
    Views:
    691
    schepp
    Sep 3, 2009
Loading...

Share This Page