How to actually write a program?
Peter Hansen
peter at engcorp.com
Mon Sep 6 18:58:12 EDT 2004
Max M wrote:
> Jp Calderone wrote:
>> Close the file. Open test_mykewlprogram.py and begin writing unit
>> tests.
>
> I completely agree in the value of test driven development, but for
> someone writing a first program I completely disagree!
>
> He will have to fight both programming in itself, and the test driven
> development process.
I would have thought that the TDD process was *how* one would "fight
programming". Do you have a better way? All the approaches I've
seen in the past were much, much more difficult and less assured
of useful results in a reasonable time.
(Also, as a new programmer, he is unlikely to have to "fight"
TDD, since he doesn't have other approaches to try to unlearn.
I assume unlearning old habits is what you were thinking about,
because TDD itself is so simple that it's not at all hard to
actually follow the process.)
> There is a big difference in learning to program, and in programming
> itself.
>
> You should simply start coding! Solve problems as you go along. The most
> important thing is to allways be aware when something is repeated.
It seems to me the OP was asking *how* to "start coding". Telling
him merely to do so is not likely to help. He already knows he
has to start coding...
> Dont Repeat Yourself
> ====================
>
> If you have written a similar piece of code 3 times, you should refactor
> it into a function.
How does he get any code at all, when he doesn't know how
to start? You can't refactor what doesn't exist.
-Peter
More information about the Python-list
mailing list