I know this seems overkill by a lot of people for single person simple projects, but my code always goes along the following lines:

  • think what I need to do, write that down, on paper, away from a computer.
  • think how to do it, and what to use to do it. again, away from a computer. Sure, you can use a computer for research purposes (other code, forums, tutorials, etc), but write down the workings on paper away from one.
  • try to poke holes in the design, think of all the different ways that the current design could fail. run test parameters through the design.
  • break the 'it should work' design into stages. (eg. in this particular case, how to store the data, how to read the data from the file, how to manipulate the data, how to output the results, how to sort the data, etc).
  • code each part in turn, making sure it works and is debugged before moving onto the next part. write test code if necessary before implementing the real code of the next step.
  • store a copy of the code every time you move on a step. this way, if you screw up and the code stops working, you can easily find the differences and you know why it stopped working much more quickly. I use TortoiseSVN for this, I like how you can commit all the different versions of your code to it as it progresses, and then easily compare the differences if anything goes wrong. If you screw up bad, you can just tell it to revert all your code to a previous stage and start again. The bonus here is additional evidence - if your prof seems a little skeptical of your code, then you can show him exactly how the code evolved by showing him the code at every stage. It's specially useful later on when documentation/more proof is required to prove that you understand the written code and how it evolved.

Some people think TortoiseSVN is overkill for single person projects and prefer having each copy in a different directory. To me, that makes it more difficult and just uses up needless disk space. I find it much easier to just right click the directory/file and select "commit" from the drop down, "revert" if I want a quick way of moving back to an earlier version or "diff" to see exactly what changes I've made from one version to another.