[Sussex] Code-writing methods

Richie Jarvis richie at helkit.com
Sat Nov 18 21:19:43 UTC 2006


Steven Dobson wrote:
> 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.
>
>   
I've been reading this thread, and promising myself to learn from the 
masters :)  Being just a hobby/emergency programmer myself, means I have 
never really developed in a team before, and not to any great depth (but 
I am starting to lean that way, if I ever get the time!)

Your comment is pretty much how I end up developing Steve, so am 
currently patting myself on the back (probably erroneously!)  Most of my 
code is fashioned as an quick and dirty answer to a particular problem - 
such as comparing 2 CSV files together to produce the difference as a 
CSV file, not mega-huge projects.  What I am trying to do whilst doing 
it, is learn my way round, and learn how to comment and write code 
'correctly' - at the moment, it seems to be just what 'feels' right, and 
makes most sense, but the professional dev's I work with (and who see 
and use this stuff from time to time) don't complain.  Maybe one day, I 
will stop pussy-footing round the edge, and dive in...

Until then - thanks for a very useful and enlightening thread.

And btw, I was previously commenting in the style of the 'bad' example 
Steve used - i.e. writing Pseudo-code first, and then writing in the 
real language - thanks for the clear and concise illustration of how not 
to do it - i'll try and behave in future!




More information about the Sussex mailing list