Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI and its controllers...

 
Ling Chung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
i'm finishing my project now, but i have a final question which seems to concern me, i have three different GUIs ; the client gui, the properties gui and a server gui. Each of these implement an interface xxGUIControl and each of these has a Controller Object xxGUIController as part of the MVC design pattern. Is it ok for all of my GUIs to have their own controller or is this overkill/ not wanted?
Thanks!!!
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You should have multiple controllers. Each representation of a model should have its own view and controller. Yes you will have more classes - this is a consequence of using the MVC pattern.
I'm curious though: why implement an interface? All of your controllers are going to be doing different things (they aren't even attached to the same model, right?), so the chance of all of them using the same method signatures is low. Which brings me to my other question: what's your Properties GUI?
 
Ling Chung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i'm not so sure if i should use multiple controllers. I've talked to some other people and they convinced me that one controller is fair enough in this application. The properties GUi is shown when starting the application here the user gives the values of the different properties for example when you start in standalone mode the user gives a databaselocation.
Anyone else cares to respond?
Thanks!!
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ling,
The MVC pattern means different things to different people. Check the Portland Pattern Repository for details on MVC.
In fact, if you were *really* using the MVC pattern in Java, you would have multiple views and controllers, your models would all extend Observable and your views would implement Observer. However, I don't think that's a requirement for this assignment.
So in the end, the choice is up to you. Multiple views and controllers seem more natural, but all those extra classes could confuse a junior programmer. Given that you have 3 different models, it probably makes more sense to go with multiple controllers since each of the models' data is different.
Alternatively, you could lump a view and controller into the same class, which may be acceptable for your server GUI since it probably only has a few modifiable properties (port, database filename, timeout.. anything else?).
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Min,
(port, database filename, timeout.. anything else?).

Yes, apply 48h rule checkbox... In standalone mode the user's GUI should feature this component.
Regards,
Marcel
 
Ling Chung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the serverGUI only gives a message e.g. Server started successfully and a shutdown button, to shut the server down offcourse. So i don't see what the model should be for this one and how my "model could signal the view" I just give a message in the constructor of the view and that's it.
Could i say that the propertiesfile and its handler are the "model" for my propertiesGUI?
So then i can just let my controller as they are?
Thanks for the help!!
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ling,
The MVC pattern is there to help you out if you have a scenario where it would be useful. You don't have to force fit your specific problem to use MVC. If your server just has two buttons to start and stop the server then there's really no need for it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic