lesson plan: BASIC for DIKULT104

[updated after class]
I taught a two hour lab on BASIC for our DIKULT104: Computing Technology: History, Theory and Practice students today. This was the first time I’ve taught BASIC, but I’m thrilled to get the chance. I have nostalgic memories of dad teaching me simple programming in BASIC when I was a kid, and even of typing programs into my C64 from computing magazines. Thank goodness for the internet, eh? The aim of this class isn’t to create programmers: we want to give students a taste of a range of languages, and for them to learn what kinds of conceptual frameworks programs can be built around and something about how to read code. We certainly aren’t trying to create a new generation of BASIC programmers, but we do hope to teach a generation that has some understanding of how programming works and that knows about the history of programming languages.

 

The best web-based BASIC emulator I’ve found so far is this one for Applesoft BASIC, although it’s not perfect. For a very gentle tutorial for this dialect of BASIC, the book A Touch of AppleSoft, from 1986, is perfect, and chapters 1-3 and 5 are required reading for DIKULT104. You can read it on Scribd.com (or course website for DIKULT104 students.)

I taught two groups following this lesson plan, and it went very well. Next year I’d like to have a better emulator installed on the computers in the lab, because the browser-based emulator wasn’t very good. If we use the 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 again we should try to get a C64 emulator, too, as it relies on a C64-specific character set – or find the / and \ signs in the AppleSoft character set.

To start us off, let’s take a quick look at this ad for a Commodore 64 from 1983 – notice how the inclusion of “Introduction to BASIC – a teach yourself program for the whole family” is emphasised.

Here’s what I’m planning on doing in our lab session:

  1. Introduce BASIC. The blurb in the New Media Reader (which is on our syllabus) is a good start. Seymour Papert’s objections (BASIC is to programming what QWERTY is to typing) are interesting. And the fact that BASIC came installed on practically every personal computer for a long time – though no longer, which may be Why Johnny Can’t Code. (That link, btw, leads to a passionate essay I’d recommend reading. Here’s a snippet: “BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways.”). Moving on to syntax and structures, have a quick look at a knitting pattern for comparison – then look at this comparison of different languages which has some fairly simple examples at the start.
  2. OK, everyone: fire up an emulator. Look, there’s a Hello World program. Let’s run it. Try making it say other things. Make a GOTO loop. Add a few more words. See what FLASH does (eek!) See if there are other interesting commands you could add.
  3. What’s the difference between PRINT 2 + 2 and PRINT “2 + 2″?
  4. REM lets you add comments to your code. Add some.
  5. We need variables:
    10 print "Tell me a number"
    20 input X
    30 print "You like the number " X "?"
    If you want a variable to contain text and not just numbers, you need to put a $ at the end of it. When you run your program it will blink a prompt at you in the top windsomething in a number. Then try a text variable (a string).

    40 print "What is your name?"
    50 input Name$
    60 print "Hello " Name$

Play around and see what you can do with this. After a bit of messing around, we’ll see what people have come up with.

  1. Let’s try an IF-THEN loop:
    10 home
    20 INPUT "What is your name?" ; Name$
    30 IF name$ = "ENOUGH" then goto 50
    40 GOTO 20
    50 end

    You can use other operators than =
    IF NAME$ <> "JILL" THEN PRINT "The teacher's name is Jill"
    or
    IF X > 100 THEN NumberSize$="big"
    Play around a bit more.
  2. OK, now we’re going to look at an example. Type this program in and see what happens:10 PRINT CHR$(205.5+RND(1)); : GOTO 10How does this work? Hints: have a look at the RND command and the ASCII character set. Another hint: the Applesoft emulator may not be displaying the ASCII characters quite right – it’s supposed to look more like this (scroll down for the screenshot).
  3. Now, what can you make, using what we’ve learnt?

Further reading (and thanks for the inspiration)

09. February 2011 by Jill
Categories: Teaching | 8 comments

Sorry, but comments from before December 2010 are lost in the database and I've not yet figured out how to display them properly.

Comments (8)

Leave a Reply

Required fields are marked *