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

Re: [pygame] OK, I'm starting this whole thing over again...



Dave LeCompte (really) wrote:
"Charles Joseph Christie II" <sonicbhoc@xxxxxxxxx> asked:


For me, I find that writing code a second time goes faster, because I've
learned a lot of lessons. Writing it a third or fourth time is just
tedious, though.

Heh, that's true, but those versions are better than the second version, so sometimes, it's worth your while.

Only when you KNOW the next version will be lots better, should you rewrite. You'll know because you'll want to forge ahead, but keep stumbling over old bad programming choices.

If you don't know what's wrong, and don't know how to proceed, you need to debug instead of rewrite.

Incremental development is good! Don't code for a week without testing it, then try to figure out why it's not working - instead build a simple bit that can stand alone, such as space ships floating down from the screen, and test it. When that's working, add a fighter craft that moves left-right at the bottom controlled by arrow keys. When that's working, add a single bullet that floats up when you press the spacebar, and disappears. When that's working, work on making the collision routine between the single bullet and the spaceship. When that's working, add an explosion to the spaceship.

In general, I like to put no more than a couple of hours of coding in, before testing. If you find you NEED to code for days on end before you can test, it's probably because you don't have the code broken down into enough classes and modules.

Good luck!

--Kamilche