Design Help Please

  • Thread starter Thread starter Jack S
  • Start date Start date
J

Jack S

Hi,

I am currently working on an winforms client app. It has three main forms
for user input. I am having trouble with a good design for persisting the
user input. The user input will be used through out the program for some
calculations and eventually will be saved to file. Right now my design is
to have a controller/process class for each UI form. Also, I want the file
to be an xml file. So, should I just create a container class with
properties for all the user input and just pass the user data? If I have
one class it would be easier to create the file since I can use .Net
serialization. Or should I seperate the user input by the forms? I am just
trying to come up with a design that will allow me to easily save the data
to file and also be easy to get the user input throughout the program. Any
ideas would be great.

Thanks

Thanks
 
Hi Jack,
I don't profess to be a theoritician on this sort of thing, but for what
it's worth, here's my gut reaction about how to organize your design.

Create classes that correspond to the natural organization of the data. Let
the various forms be the editors of those classes, but don't force the forms
to correspond exactly with each class. I'd create controls that *are*
designed for collecting information associated with each class and use them
to construct your forms. You may want to have the underlying classes raise
changed events and have the editor controls designed to update themselves
when the underlying data changes. This is particularly useful when your
application gets complex and data is rendered and edited in multiple places.

There's nothing to prevent you from using .NET Serialization with the data
classes, so long as you have one that contains (directly or not) the others.
Just make sure they are serializable.

Tom Clement
Apptero, Inc.
 
Back
Top