This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
Joined: Apr 10, 2005
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.