A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
OK - so I'm attempting to design a UI for my application in plain old Windows Forms. I haven't designed UI's before, so I'm a little lost. One way to do it is to dump a lot of code on the MainForm, while trying to follow the MVC pattern as much as possible. Dumping code on the MainForm has never really appealed, and does not seem extensible/flexible enough. I'm sure there must be other, better ways to do this.
I'd like to design my UI such that I put as much of the code into the data, as opposed to hardcoding the data into the code. I'm sure this is a relatively common issue, and I'd love to hear some thoughts/opinions from those more experienced than I.
If you're new to Windows Forms, I'd suggest you first get a simple little app working, without regard to well-structured code, just to get your mind around it. Then I'd look at patterns like MVC and MVP and data-driven code. You might also look at the new stuff in .NET 3.0 if this is an option for you, since Windows Forms will be slowly on the way out.
Tuesday, February 13, 2007
> Dumping code on the MainForm has never really appealed, and does not seem extensible/flexible enough.
One way is to make it a separate class that's a member of the form. For example, if the Form is a text editor, and the Form needs to remember which text is selected, then:
* Create a Selection class, to contain the state of the selection
* Declare an instance of the Selection class as a data member of the Form
* Form event handlers (e.g. Form_MouseDown) are implemented as thin wrappers which merely invoke corresponding methods of the Selection class.
By doing this:
* Form contains no methods except event handlers, and no logic except creation/destruction
* Auxilliary classes like the Selection class can be unit-tested independently of the Form class.
The main issue is that I'd like to make the UI extensible. I'd like a programmer to be able to create Add-ins for the UI - i.e. adding menus/toolbars etc. that expose some new functionality.
I've been looking around for models for doing this, and the only thing I've come across so far is SharpDevelop. They have a few interesting concepts such as the AddInTree & so on.
However, I worry that trying to amend SharpDevelop to my needs might be overkill. So what I'm doing right now is whittling down the SharpDevelop core to my needs.
I still am concerned that my lack of knowledge in UI design/architecture is resulting in sub-optimal design. Any thoughts?
I like the custom control idea, and i'm currently playing with it. But what I'd ideally like to do is:
1. Provide the basic interface
2. Allow users to install add-ins that dynamically insert new toolbars/menus etc - i.e. allow them to configure the look,feel and functionality of the applications as much as possible.
Currently, what I'm doing is experimenting with the SharpDevelop architecture. Their entire application is built through a plug-in architecture (I imagine Eclipse is something similar as well). It's very interesting, esp. since i have no real experience in designing GUI's etc. It's an experimental approach, so if you might have any thoughts or comments, I would love to hear them.
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz