You code a line at a time

One thing I see my students doing all the time is trying to write an 80-line program in one shot. Then, when it blows up, they are overwhelmed and have no idea where to find the bugs.

After many, many years of programming, I find myself sometimes testing every line of code I write. Other times, there may be four or five lines that make no sense unless they are all written at once, so that they must be tested as a group. If I have to write ten lines without a test, I am extremely uncomfortable!

3 comments:

  1. I've written at least 30 pseudorandom number generators, 15 stream ciphers, and 15 block ciphers without facing too many errors. Sometimes a digit that's different from what it should be just blends in.

    ReplyDelete
  2. So.... you teach economics...
    and poli-sci...
    and philosophy...
    and... programming?

    What?!? I would think it was a nightmare keeping up with all of that.

    ReplyDelete
  3. It saves a lot of hassle. Nothing worse than confronting a few bugs simultaneously!

    ReplyDelete