Teaching Programming with Basic
lackofimagination.org
lackofimagination.org
I still remember the moment I ran into my parents bedroom to tell them I could print a line of text to the screen. That thrill hasn’t left me in over 30 years.
I wonder how much of the spaghettiness BASIC is infamous for is due to the language, and how much is about the programmer's mental models -- my recent raytracer for the ZX Spectrum [0] is a pretty straightforward transliteration of my JS ones.
A 5 year old can tell you what:
10 PRINT “HELLO”
20 GOTO 10
Does. You can basically look at each line In isolation and figure out what is going on. There is no nesting or scopes.In addition other than the quotes there are minimal additional symbols. Even parentheses in a function call can be confusing.
Imagine a world where ram remained constrained but GBs of flash was basically free (like now), how different computing would look.
It meant that you got maybe a couple debug cycles per class hour at most. The lectures, and most programming and debugging, were conducted by tracing through programs on paper or the chalkboard. The simplicity of "thinking like the machine" in BASIC was valuable for this process.
Maybe not any more, now that computers are widely accessible. But I have a hunch that thinking through algorithms is still an important stepping stone towards becoming a programmer.
I dipped my toes in BASIC on the C64 when I was around 8 until I got my first PC at 10, and there I continued to play around with QBASIC (it was AWESOME for having the on-line help built into the IDE!!!), but my efforts never amounted to much, I never really got it and I never really made anything beyond tic-tac-toe and a few animations using the "screen 13" mode..
I only learned to program proper in PHP and later C, and JavaScript, then ASM, but to this day, I've never done anything substantial in BASIC, it's just too hard! But, as a language that introduces a few of the easier concepts, yeah, I kind of think it might be good.. I tried once to "bootstrap" on the C64, I wrote a text-editor, so that I could write the asm files.. That worked out okay. Then I started writing the assembler, in basic, and got it to spit out a few opcodes and it did generate executable images in the end, but it was so slow (something about how you load characters in from disk and concatenating strings made it run out of string memory right away and start spending all the time cleaning up instead).
I'm wondering what language I should introduce to my kid if he shows the interest, it might be whatever is adjacent to the game he might want to mod..
At the time, I had no concept of things like "functions" or "subroutines" and was writing a BASIC program where I needed to re-use the same dozen lines of code to transform a value.
I attempted to "kludge" together a block of code that you would GOTO, but I couldn't figure out how to automatically return to the next label of code, e.g.:
CLS
10 X = 32
20 RETNUMBER = 40
30 GOTO MYFUNCTION
40 REM CONTINUE HERE
<snip>
70 ARG = 64
80 RETNUMBER = 100
90 GOTO MYFUNCTION
100 REM CONTINUE HERE
<snip>
MYFUNCTION:
REM DO STUFF WITH ARG
GOTO RETNUMBER
Of course, I hit an immediate syntax error - not being allowed to pass a variable to the GOTO keyword.As I recall I ended up implementing a bunch of IF-ELSEIF statements like this:
IF RETNUMBER = 40 THEN GOTO 40
ELSEIF RETNUMBER = 100 THEN GOTO 100
The sheer explorative value of a quick interpretive language like BASIC cannot be understated.I think that's the first time I've seen 'quick' and BASIC in the same sentence.
Gosh, yes, I, like many of my generation, started out with BASIC. No reason to impose that on the next. We don't teach slide rulers in school either anymore. Something interactive, fairly save and not too mind wrecking would be nice. I'm no educator, but my best guess would be something like Racket.
I was referring more to "quick" in the sense of quick to get started, no installation, since it was "bundled" with the vast majority of systems. And since a lot of computer is booted directly to some version of basic in the ROM, it was pretty frictionless.
Heh I don't think slide rules are a very relevant comparison - since you don't really build things with slide rules. A better analogy would be building with Legos versus building with Minecraft.
It comes down to what you want to teach as an educator, most kids are obviously going to be happier with something that's visual and interactive, whereas the teacher wants to emphasize concepts like logic and flow control. A happy medium might be something like scratch.
The closest it comes to pedagogy is claiming (without evidence) that BASIC is how computers work instead of those other languages with useful abstractions.
> BASIC lacks some universally agreed-upon programming concepts
> if one wants to understand how computers work, I think it’s easier to start closer to the level they operate
Strangely, there's no mention of the PEEK and POKE commands if the author wants us to be lower level . . .
However “gosub” and lack of arguments is a major shortcoming.
I had a hard time understanding the classic Microsoft demos and book/magazine games as a child.
Looking at them again, they are still hard to follow — the code is a royal mess!!!