Re: Document A Project

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andy wrote:
> 
> If you were writing down code on paper
> how would you write it down?
> 


Last two programs, Multisearch and Resizer, i wrote on paper, because i find it
easier to think that way, i tend not to complicate so much.

first it should be at least a little clear in your head. then go writing.
i first define (draw) user interface (if any) and global variables and their
structure (for this for me C structures are much easier that Eu sequences).
global variables should be commented, and return values of functions, and which
global variables routine modifies, other things only if confusing or not obvious,
because it saves you time and important comments are that way more easily
visible. if there are too much comments its hard to keep them in sync with code
they comment. its best if code comments itself (again for this C is better than
Eu, but Eu has many other advantages over C).

for routines: if they are complicated i do them like this:
on top of routine (inside) i write down neccesarry steps, then write actual code
for each step. like this:

-- step 1: explanation what to do

-- step 2: explanation what to do

-- step 3: explanation what to do


--1. <no need to write same comment here again.>
<CODE>

--2.
<CODE>

--3.
<CODE>



i dont write pseudo code, i just write in euphoria, except for very simple and
obvious things, then i use pseudocode. i leave out some un-important things so i 
dont have to write so much (local variables declarations, simple routines,...).

i write with pencil so that i can easily erase things with eraser.


i don't like to test my code during development (like i used to), i just like to
write all code (at least the most important), and then consciously reserve a lot
of time (few days) for debugging. that way debugging is more enjoyable :)
Independent routines and similar things i can test immediately, or write test
code down and test them in debug time.


also, leave hard problems and bugs for end, solve easy ones first.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu