tags:

views:

301

answers:

3

I have a c# windows form app in which we did a rapid prototype for the client. The extent of my c# experience has been with ASP.NET/C# so its a bit different when it comes to the actual structure of the software. Time is a factor in this project since it is a school project and we have a little under 2 months to be done.

The software will be mainly database driven.

Current Project Design

Currently there is 1 main windows form and a bunch of class files.

One idea we had is that since most of the actual code of the program will be in classes, should we just split the windows form up into a bunch of tiny windows forms with one main driver so to speak? or just leave it as one large form and try to have as little code as possible in the main win form?

What are your suggestions on the design of a c# database driven windows form app?

Please give pro's and con's to each.

+1  A: 

Personally I favor an MDI (Multiple Document Interface) over a single form because a single form can become cluttered without careful planning. Also most clients like the idea of a MDI for database driven apps because it reminds them of Microsoft Access. I also like the idea of breaking everything into classes. The rule of thumb that I use for deciding weather or not to make a class is "Will I ever in my programing career need to do X again?". In this case X is what you would put in that class (e.g. Determine Leap Year). If you think that your form won't become cluttered then totally go for a Single form. Hope this helps you decide.

Lucas McCoy
if you'd look at the Microsoft software trends, you'll realise that MDI is on the way out. Not saying that Microsoft software rules, just that they seem to be used less and less these days...
cruizer
@cruizer: This is true with just about all software (apple, linux, etc), but when it comes to database applications MDI is the way to go. Just look at Access 2007, even though it's got the ribbon and stuff they still use MDI.
Lucas McCoy
A: 

A monolithic form that provides "kitchen sink" functionality is every bit as bad as a monolithic class that provides "kitchen sink" functionality.

Since it's a school project, I'll assume you're still learning this stuff.

Break the application down into smaller forms that do less. Each form should do one thing and do it VERY well. Its functionality should be well defined, cohesive, and as loosely coupled as you can make it. Try to keep the database code out of it (move that code into your classes, and invoke them from the form).

A form is nothing more than a way to display the information that is returned by the classes (in other words, a view on the data). Keep it simple like that and you will find it much easier to add new forms, change the existing forms, and extend your application down the road if you need to.

Mike Hofer
+1  A: 

While I agree that you almost certainly want more than one form, I'm not at all a fan of MDI. Rather, I prefer to think about the common tasks that users will perform and design application around the user's expected work-flow, such that there is a natural progression from piece to piece. Of course, that also means providing a way for power users to get past this expected flow when they really want to.

Joel Coehoorn