Roland Weigelt

Born to Code

News

  • Recent Twitter updates:
  • GhostDoc website:
  • .NET User Group:
  • Personal homepage:
  • XING:
    XING
  • PDC08 - I'll be there!
  • PDC08 - Party with Palermo
    Party with Palermo

.NET related Links

Dialogs are too much Stupid Code

If you develop a complicated dialog (editing non-trivial data structures, showing/hiding parts of the dialog), it usually turns out to be a lot of work until everything is working as it should - and this doesn't really surprise anyone. If you use something trivial as a OpenFileDialog or a MessageBox, you know that this is just a matter of minutes.

But what really gets on my nerves are these "simple dialogs". Imagine a dialog consisting of a couple of text fields and some checkboxes. Some text fields are disabled unless a certain checkbox is checked. And so on, I think you get the idea. Each time I have to write one of these dialogs, I...

  • underestimate the actual time required to "get things right", and
  • ask myself "how often did I write code similar to this?" when I move data in and out the dialog, handling OK and Cancel, enabling/disabling controls.

Sometimes I feel like a "human code generator" because there's virtually no real thinking involved when writing down the code for such a dialog.

Is this something I just have to get over with? Any ideas to keep the amount of code as low as possible?

Posted: Dec 30 2003, 05:49 AM by WeigeltRo | with 4 comment(s)
Filed under:

Comments

Paul Gielens said:

Think final state machine (FSM) because that is what's behind the dialog. Perhaps you can think of any reusable code in the process.
# December 30, 2003 8:24 AM

Doug King said:

This might be overkill, but there is a wizard sample included with the MS User Interface Process Application Block

Summary: The User Interface Process Application Block provides a simple yet extensible framework for developing user interface processes. It is designed to abstract the control flow and state management out of the user interface layer into a user interface process layer. This enables you to write generic code for the control flow and state management of different types of applications (for example, Web applications and Windows-based applications) and helps you write applications that manage users' tasks in complex scenarios (for example, suspending and resuming stateful tasks). This leads to simpler development and maintenance of complex applications. The User Interface Process Application Block can easily be used as a building block in your own .NET application. (11 printed pages)


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/serviceagg.asp
# December 30, 2003 11:40 AM

TrackBack said:

# December 30, 2003 6:59 PM