This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I've seen quite a few posts here regarding the MVC pattern, but haven't been able to find the answer to my doubts. I have one class for each view -the Search frame -the Result frame -the Reserve Flights frame On click of the Search button, the search frame creates an instance of the Result frame. on click of Reserve button on the Result frame, an instance of the Reserve frame is created. Now, when designing the controller, 1. should I have a controller for each View? In this case, where can I instantiate each contoller? I considered instantiating the controller for my Result frame in the Search frame class and so on, but this goes against the idea that a GUI shouldn't know a controller( even if the controller in this case is not for itself, but for a succeeding frame - is this correct?). 2. Should I have just one controller for all the views? This means that the one Controller class should have references to all the views(search, result and reserve frames). Again, the reference for each frame can be set into the Controller only from the preceding frame. Or maybe I should instantiate all my frames along with their respective controller(s), in the main program itself, and show them only at the appropriate moments. Is there any other way of approaching this? Venita.