[Sussex] Code-writing methods

Steven Dobson steve at dobson.org
Thu Nov 16 22:13:48 UTC 2006


Desmond

On Thu, 2006-11-16 at 16:11 +0000, Desmond Armstrong wrote:
> This is top-down designing and from my experience is absolutely the 
> right way.

Top-down is *not* the one true way of designing code.  It can fail if
you do not understand the how the lower levels will have be implemented
in order to meet their design goals.

I've been involved with several big code developments where a top-down
designs has made some bad assumptions (or had no idea) how the lower
levels could be implemented, and as such have had to re-work their
design.  I even had one experience where after telling the designer that
he couldn't use TCP/IP comms for intra-process message passing that "you
have to make it work, that's the way we've designed it!"  This was just
not possible - the problem was in the TCP/IP stack implementation, and
we had no control over that at all.

Designing the lower levels first (bottom-up) is *not* the one true
either.  This can fail because it is easy to lose sight of your goal -
the problem your program is trying to solve.  In team programming this
is can happen very easily as every one goes off and designs their own
little bit and none of the bits plug together.

The best advice I had in programming style was to use a
top/bottom-down/up approach; in other words "to attack the problem from
all sides at once."  You need the top-down overall design to give
direction, but don't do this in any real detail - leave it flexible so
if an assumption proves false then you haven't set to much of you're
work in stone.

Once you have a overall sketch, pick one function[1] (the design should
suggest which that should be as some functions will depend upon others)
and implement all it's components completely: the GUI bit, the middle
bit and the system's bit.  That way you know that that function works.
Then you can go back and pick the next function to work on.  And thus
build your program one function at a time.

This has the added advantage that as soon as you have enough functions
implemented to be useful you can release.  In pure top-down you don't
start to get working programs until you complete the lower-levels.

Good program management on such projects is, in part, working out the
best order to implement the functions so that you make best use of the
resources in a timely and cost effective manor.

Steve

[1] Just to be clear I mean "function as an operational thread" not as a
unit of code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20061116/2526dda9/attachment.pgp 


More information about the Sussex mailing list