Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

Started Programming Young

September 5th, 2011 by Multimedia Mike

I have some of the strangest memories of my struggles to jump into computer programming.

Back To BASIC
I remember doing some Logo programming on Apple II computers at school in 5th grade (1987 timeframe). But that was mostly driving turtle graphics. Then I remember doing some TRS-80 BASIC in 7th grade, circa 1989. Emboldened by what very little I had learned in perhaps the week or 2 we took in a science class to do this, I tried a little GW-BASIC on my family’s “IBM-PC compatible” computer (they were still called that back then). I still remember what my first program consisted of. Even back then I was interested in manipulating graphics and color on a computer screen. Thus:

10 color 1
20 print "This is color 1"
30 color 2
40 print "This is color 2"
...

And so on through 15 colors. Hey, it did the job– it demonstrated the 15 different colors you could set in text mode.

What’s FOR For?
That 7th grade computer unit in science class wasn’t very thick on computer science details. I recall working with a lab partner to transcribe code listings into a computer (and also saving my work to a storage cassette). We also developed form processing programs that would print instructions to input text followed by an “INPUT I$” statement to obtain the user’s output.

I remember there was some situation where we needed a brief delay between input and printing. The teacher told us to use a construct of the form:

10 FOR I = 1 TO 20000
20 NEXT I

We had to calibrate the number based on our empirical assessment of how long it lasted but I recall that the number couldn’t be much higher than about 32000, for reasons that would become clearer much later.

Imagine my confusion when I would read and try to comprehend BASIC program code I would find in magazines. I would of course see that FOR..NEXT construct all over the place but obviously not in the context of introducing deliberate execution delays. Indeed, my understanding of one of the fundamental building blocks of computer programming — iteration — was completely skewed because of this early lesson.

Refactoring
Somewhere along the line, I figured out that the FOR..NEXT could be used to do the same thing a bunch of times, possibly with different values. A few years after I had written that color program, I found it again and realized that I could write it as:

10 for I = 1 to 15
20 color I
30 print I
40 next I

It still took me a few more years to sort out the meaning of WHILE..WEND, though.

Posted in Programming | 3 Comments »

3 Responses

  1. Justin Ruggles Says:

    My first introduction to programming was also BASIC. In 2nd grade we would go to the library to use the Apple II computers. Each computer had a set of laminated sheets beside it, each with an example program. We had to copy each program and run it. Then we changed or combined programs to make our own.

    I couldn’t resist buying a shirt recently put up for sale by one of my favorite bands, Guster. It says:

    10 print “guster is awesome”
    20 goto 10

  2. DrMcCoy Says:

    Heh, my first language was GW-BASIC as well, in 1993-ish.
    Learned it mostly through the manual that came with it, and a book of code listings (that didn’t all work because they were actually for a slightly different BASIC dialect, IIRC).

    I still remember writing programs for those little “personality test” (“Are you greedy?”) found in the Mickey Mouse magazine. A new program for each test, because I hadn’t yet grasped that I could read the questions and answers from a file.

  3. Jim Leonard Says:

    My first introduction to programming was actually LOGO, but when I wanted more control I switched to BASIC. For your amusement, one of my earliest programs was also my earliest hobby (multimedia with computers), where I discovered how to simulate chords when all I had was a single speaker. BASIC listing is here: http://www.oldskool.org/shrines/lbd/examples/arpeggio.html
    And the output it produces is here: http://www.oldskool.org/shrines/lbd/sound/pc_arpeggio.au

    An interesting property of the above that I haven’t heard exploited in chip music *ever* is the speed of the arpeggios was variable (the result of a programming mistake combined with an attempt to give the chords timbre). 27 years later I’m still slightly proud of that bit.

    If that tune sounded somewhat familiar, it was my attempt at reproducing the main recurring theme of the Tales From The Darkside show “The Satanic Piano”, which I had just seen on TV.

    Geez, I am *such* a nerd.