[Tutor] software design

Bruce Sass bsass@freenet.edmonton.ab.ca
Sun, 4 Mar 2001 15:23:54 -0700 (MST)


On Sun, 4 Mar 2001, Katharine Stoner wrote:
> Hi all,
>
> Does anyone know of a good scource on how to design programs before you start programming?
>
> -Cameron Stoner

Coming at it from a mostly hacker^H^H^H^H^Hobbiest background,
professionals and academics may have different opinions, it
appears that it is the kinda thing you just get a feel for.

In general...

The better an understanding you have of the system the problem arises
in, the easier it is to design a program that does what you want and
is usable (flexible).  This is true at both the user level (running
the program) and with the individual coding tasks.

If your program is a `control center' kinda thing (most apps), you
probably want to start with the user interface; `have A, need to get
to B' types of programs (utilities and tools) can be approached in a
more linear manner.  For example:  If you are writing a editor you
could start with a GUI designer and do the main window, then some
dialogs - don't worry about the details, just define the
functionality.  A program to translate something would start at the
beginning and take it step by step, you can always go back and rewrite
the steps as functions or methods of objects later on.

The data structures you use to represent things are probably the
most important bits of the program.  Often you have data coming in
a particular format which makes such'n'such structure a natural
choice, but if you are going to be presenting the data as information
most of the time... the natural structure may result in your code
having to work harder than if you had used a structure closer to what
the output of the program requires.


I usually go through this design loop:
 - work on the UI
 - work on the low-level stuff
 - work on the data structure
 - connect the UI and low-level to the data structure
   to provide a particular function
 - test

at some point the "work on..." stuff is skipped (but never forgotten)
because I have settled on a design, all that is left is to write the
code for specific functions, and test.  The program often ends up
looking quite different from how it started; however, if I find I want
to fiddle with the data structure(s) everytime new functionality is
connected up, I know I don't really understand what I am trying to do.

HTH


- Bruce