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 just read Head First Design Patterns (it's an awesome book!). In the chapter on MVC, it says the controller creates the view. This works great for their example, because their view is the main JFrame. In my case, my views are components I want to add to my existing JFrame.
I have the EXACT same problem as this guy and oddly enough he also just read the same book:
This however does not sit right with me, though I'm not sure why.
Does anybody have any thoughts or insights on the above.
In addition to his question, should my main JFrame be creating controller1 and controller2? Or should this be done in non-gui code and passed into the MainFrame constructor?
or should I do this:
I believe the first approach is better as long as the MainFrame is allowed to create the controllers. With the second approach, if I have 10 controllers, these all have to be passed to the MainFrame constructor. Or are none of these approaches correct?
I'm open to any advice. I feel like I'm closer than ever to understanding MVC thanks to HFDP, so thanks if you were involved with that book.