Re: TIB: Goto's


[Prev][Next][Index][Thread]

Re: TIB: Goto's




Christopher Robin MacDougald wrote:
[...]

> Another thing I NEVER do is write sub programs. That right there is bad
> TI basic.

Why?

> If you have to write a sub program just to make your main
> program work you need to seriously rethink your coding method.

I don't use sub programs to make my main program work. I use them to
ease up the programming task.

> I write
> the code out ALL on paper first and then translate into TI Basic.

I write a sketch.
I then divide it into subprograms.
After that I sketch out some algorithms for each subprogram.
I then make each subprogram and test it.
Finally I make a main program that uses all of the subprograms.

Advantages
 - Much easier to oversee
 - The task can be split up between multiple programmers if desired
 - It is easy to modify a single subprogram. If you know what the
program is supposed to return, you can make all the changes you want in
it without affecting all the other code. Your main program relies only
on the output from your subprogram.
 - You always know where the error, if any, is, as you test each
subprogram independently.
 - You don't have to search through 5k+ of code, a screen at a time, to
find a perticular place.
 - Runs using (considerably) less memory.

 ...I might have forgotten some.

Drawbacks:
 - More memory usage (very few % though!)

That's only one drawback, and I'd say the advatages seriously outweigh
it.

This comes from personal experience as well as what they teach us here
at the computer science dept. :-)

[...]

-- 
          Rene Kragh Pedersen
------------------------------------------------------------------
man: Why did you get a divorce?
man:: Too many arguments.


Follow-Ups: References: