Hi Everyone, I'm in the process of designing a GUI application using Swing. Is there any information available on the correct way to separate the business logic from the GUI piece? For example, if I want to create a GUI screen which accepts user information(i.e. name, ss#, phone #, etc), where is the right place to put the validation code? I plan on creating a User class to store this information. But should the validation code go in this class as well? Hope this makes sense. Mansi
I'm in the process of designing a GUI application using Swing. Is there any information available on the correct way to separate the business logic from the GUI piece?
Well, there are many "correct" ways to do it, but more or less universal one is Model-View-Controller (MVC) pattern (or a bit more simplified Model-View pattern). The model is the class that contains business logic, the view(s) are your GUI frames, and the controller is the class that acts as a listener to user events, calls the methods of model, and selects the views. The model can also update the view(s) using some weakly-typed notification. Eugene.
Joined: Aug 06, 2002
Thanks for the information. Is there any reading material available for this where I can get examples? Mansi
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Separating the business logic from the gui components