Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Tips/Design patterns for GUI design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Tips/Design patterns for GUI design" Watch "Tips/Design patterns for GUI design" New topic

Tips/Design patterns for GUI design

Andy Joness

Joined: Sep 15, 2009
Posts: 24
I'm currently getting in to design patterns and I'm finding them very useful, however I'm now refactoring an older program and I'm needing some advice.

I've set up a User class, then made NewUser and ExistingUser subclasses. But I'm wondering where is the best place to catch the user's errors e.g. if they enter an incorrect age, or an incorrect name etc. Would you do this in the form itself or in the User class? or perhaps create a separate class for it?

The idea is the user's info gets written to a file if they are new, or if they are returning they can edit their info, so either way their details need to be correct. I've tried searching google but not really had any luck
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You're not really talking about GUI design but more about the programs architecture. There are many ideas about how to separate different aspects of the program and many solutions. However since this is the beginning java section I would start with the MVC pattern.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I agree. Here's the link:
subject: Tips/Design patterns for GUI design
It's not a secret anymore!