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.
Hi, after reading tons of posts and refactoring my GUI over and over again I think MVC is a must - and after I did it the design and the code 'feels' a lot cleaner. The hadest thing to understand for me was that MVC exists on the Swing Component level as well as on the application level which is the one i've finally implemented: Gui - Parses the commandline parameters and starts the GUI.
View (is a JFrame) - Defines the layout and look of the Reservation Application. add toolbar add JCombobox ... Controller Defines the behaviour of the Reservation Application view.button1.addActionlistener(this); ... selectConnection() handleError() I hope this helps, Bern
Joined: Sep 16, 2002
Off course not to forget the Model it contains all busines models like get airportsan book flight. All it needs is a reference to a Data class (i.e. a table). So it can be used by another View-Controller combination like HTML. Bern
Joined: Jan 02, 2003
Originally posted by Bernhard Woditschka: Off course not to forget the Model it contains all busines models like get airportsan book flight. All it needs is a reference to a Data class (i.e. a table). So it can be used by another View-Controller combination like HTML. Bern
Thanks Bern, its been a very good explanitation from you, i got a good picture of MVC with Swing components. Thanks, babu
Hi I have just uploaded the assignment and will take the test this afternoon. I didn't use MVC for my client either. Can say i kind of added the controller and model to one class taking care of listeners/book/search etc. Ofcourse i had a separate GUI class. Only place MVC is used is for the JTable... Don't know if this is the way to do it(will se in a week...) but it works fine and it felt unnessesary to breake down my desing just do fit in in to the MVC pattern. Would get very supprised if i fail just because I didn't use the MVC pattern!! Has someone passed withour implementing MVC???
I have implemented it in the following way JFrame - Displays data, and is the listener for all actions. DataFacade - Provides methods bookSeats, connect and seach. Connection - Provides methods of the data class. Not sure if this is MVC (don't it strictly is) but I think that this is by far clean enough.