Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

MVC - Current Service instance

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm wondering if anyone can help me out with my design.

I've implemented an MVC architecture for the client side gui. I'm using RMI to get an instance of a local or remote Services interface that holds the methods book & search.

The controller is registered as a listener of the view and so when a user clicks the book button the controller needs to determine the currently selected row by querying the view and then needs to call the Service book method with the record number as a parameter.

Now i'm just wondering where I should be putting the Services instance so that it can be called by the controller? Should it be:-

1) A static member of some class (MainClass)or
2) Passed into the controller with the model and view or
2) Should the service register with the controller and the controller should fire an event sending the recNum as a parameter in the event?

Any help is much appreciated.
 
Peter G Walker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should the model contain the reference to the services instance? I.e should I pass the service to the model constructor?

Most of these will work i'm just wondering if anyone has a better design? since I think SUN is mostly interested in a well designed system.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic