[Tutor] General design question (Tim Golden)

Lie Ryan lie.1296 at gmail.com
Wed Jul 2 17:31:22 CEST 2008


> If I have a set of numbers, or strings etc. which have been
generated 
> and I then want to do something with them, for example a sum function 
> call.  Is the best way to put those items in a list, or similar 
> container, before applying the function.

The best design tips I could give is not to optimize early. Choose the
way which is the easiest to implement first, if for example, that simple
solution doesn't solve the problem satisfyingly enough (e.g. it's not
fast enough) then you find alternatives. Whether you should use a number
and add them over and over or make a list then use sum is not a problem,
choose one which feels most natural to you and the program you're
writing.



More information about the Tutor mailing list