wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Separating the business logic from the gui components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Separating the business logic from the gui components" Watch "Separating the business logic from the gui components" New topic
Author

Separating the business logic from the gui components

Mansi Dave
Ranch Hand

Joined: Aug 06, 2002
Posts: 49
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
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

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.
Mansi Dave
Ranch Hand

Joined: Aug 06, 2002
Posts: 49
Thanks for the information. Is there any reading material available for this where I can get examples?
Mansi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Separating the business logic from the gui components
 
Similar Threads
Terminology Clarification
More on MVC
Handling Null & Empty String in your Tranfer Object
Help Needed!
UrlyBird - the effect of 48 hours? please do not ignore my question