I've been thinking about BASIC a lot, as I've been looking for "the easiest programming language for a non-programmer to learn". I'm not exactly sure that rewriting these in Python/Ruby/JS/VB.NET using "better coding patterns", because a lot of the things programmers take for granted are really tough for complete newcomers. Examples:
- I remember when I started, using BlitzBasic, I had a really hard time understanding the concept of arrays.
- A friend of mine, when showing him the statement 'x = x + 1' was confused; surely, x cannot also equal x+1.
- When teaching Python, the concept of function parameters and variable scope is always a struggle.
To some degree, having spaghetti code and all globals is useful for teaching because it 1) gets people excited to program and see something working and 2) demonstrates why you don't want to do those things. I remember when trying to write my first text based CYOA game, I was so excited to add content to it and see it on screen, but also learned very quickly that having to scroll through 20 pages of if statements was not fun, and why functions would help. I'm not sure if someone explaining "encapsulation" to me would have really taken root.
I think there should be a rewrite of the book, for modern languages and development environments, but keep the complexity extremely low, like 70's BASIC was intended.
> To some degree, having spaghetti code and all globals is useful for teaching because it 1) gets people excited to program and see something working and 2) demonstrates why you don't want to do those things. I remember when trying to write my first text based CYOA game, I was so excited to add content to it and see it on screen, but also learned very quickly that having to scroll through 20 pages of if statements was not fun, and why functions would help. I'm not sure if someone explaining "encapsulation" to me would have really taken root.
While I'm certainly no fan of spaghetti code, I think this is an important kind of experience for novices. I, for example, let mentees at work go down a wrong/weird path with their code for a couple weeks when I see bad code patterns or poor choices in algorithms/data structures in order to give us something to discuss and correct later when they start to hit pain points that I, usually correctly, predict they'll hit. I let them know that they're making their life harder, but I don't direct them to change course (some do on their own, others don't). Telling someone who's just learning how to do things the "correct" way (to the extent that there is a singular correct or a small set of correct options) doesn't give them sufficient motivation and experience to actually learn and internalize it. Often you get a kind of cargo cult mentality around the things you teach them since they lack comprehension of why those are good ideas or better ways of organizing code or whatever, or a later rejection of what they're taught because they don't understand the motivation behind it.
Also, letting them go down the path of spaghetti code or confused structures gives an opportunity to teach them refactoring techniques, which even expert programmers still have to apply to systems they develop (most people don't write perfect code on the first pass, and most systems having changing requirements which would render the perfect code imperfect if they did).
>- A friend of mine, when showing him the statement 'x = x + 1' was confused; surely, x cannot also equal x+1.
I think the best thing that my CS 101 prof did was always refer to the assignment operator as "gets" so you'd say "eks gets eks plus one" out loud. It really helped divorce assignment and equality in my mind.
> A friend of mine, when showing him the statement 'x = x + 1' was confused; surely, x cannot also equal x+1.
Some people say a language like Haskell would be no harder, and maybe even easier, for someone with no previous programming or CS experience, than something like C or Python. Comments like that make me wonder if they're right!
(Haskell is a pure functional language. And so has the same reaction as your friend. Variables are immutable. Anything else would be madness.)
I was ten when I first started learning BASIC so it wasn't until a few years later that I first encountered algebra as a late year lesson in math class. By that time x=x+1 was very much ingrained into my way of thinking so I had to unlearn some of that before I could understand algebraic equations. Wonder how many other kids of that era ended up going through the same process.
Every programming class I ever had was using logo on an Apple II, where mostly you just sat around making making the little puck fly off the side of the screen at warp 9.9. Most of the personal computers in the 80s came with a basic interpreter built in and they were largely compatible with each other aside from some syntax differences and the extended screen characters being vastly different. Typing in programs from magazines and writing my own did far more for me then any course I ever took. I dabbled with Turbo Pascal when I got my first IBM knock-off but settled for a little $20 C compiler - Power C - that worked in real mode and spit out DoS executables really quickly. Porting code from Unix to the Power C runtime taught me a lot. Today I write in Go almost exclusively and marvel at how far things have come.
This is tricky, because on one hand, you want to ignore structure and a lot of syntax to just get started, but on the other, you want to see the results and see something real, not just print the sum of two inputs, and you quickly need a real language for that.
Thanks for reminding me of these wonderful illustrations. Your comment made my day!
They were an essential part of the book, for engaging your imagination. They were also a gateway to books like Heiserman's "How to build your own self-programming robot":
It's funny that this got posted right now. I'm working on exactly this project. You can find a collection of text-based Python programs written in the style of the games in Basic Computer Games here: https://github.com/asweigart/gamesbyexample and installable through `pip install gamesbyexample` More info here: https://pypi.org/project/gamesbyexample/
Hi, I'm Al Sweigart. I wrote Automate the Boring Stuff with Python. My next book (working title The Big Book of Small Python Projects) is exactly what Jeff talks about in the article. I started on this three years ago, and the style of the programs are 1) short (under 256 lines, as an arbitrary limit) 2) text only (so that readers can link cause-effect between the print() calls and the text that appears on the screen 3) requires no additional libraries outside the standard library 4) fits in one source code file for easy copy-pasting, along with some other guidelines.
My main fear is that I'm just old, and I'm mistaking the nostalgia of how I learned to program for good pedagogy in modern times (this is a mistake the One Laptop Per Child project made). But I figure this might be a good start for beginners who want to see what programs "look like". I already have JavaScript, Java, C#, Kotlin, and Go versions also planned. The books, like all of mine, will be released under Creative Commons licenses. The first book should be out in a few months.
I thought that one of those book covers looked familiar so I went over to my vintage computer books shelf and found the "more" edition. I think it's a 10th printing and in nearly perfect condition. Not sure I could handle typing in all of that code from the book like I did back in the 80's due to aging eyes but the book is very nostalgic for me.
I typed in a lot of these in the late '70s, it was "learning Basic the hard way" to get them to run. My access to computers was limited, so I read them more than used them at a computer. I later bought:
I remember I had to hide them in my other books because kids would pick on me if they saw "nerdy" books like this, and teachers didn't like you reading anything interesting during their boring lectures.
IMHO re-implement these using modern ES6 javascript targeting browsers above IE11 (so ES module support is good) and a simple canvas library (or even P5.js) to really capture the original spirit of BASIC. It's supposed to be a modern language that's available everywhere, and web browsers fit that mold nicely. The dev tools window in your browser is the new QBASIC, just sitting there waiting for a kid to open it up and blow their mind with what's possible.
Interesting idea! I had to think about what you were describing, but that actually is very similar in spirit to the experience back then.
It's kind of like discovering the assembly monitor on the Apple ][, which you could get to by poking a value in Basic. I remember typing in an assembly program I found in a magazine that sampled audio from the cassette recorder, and played it back on the speaker. It was gritty sounding, but an amazing discovery for me at the time (about 1982).
(I'm always doing Ctrl-Shift-C to copy text from the browser when I forget I'm not in the terminal anymore--which brings up the element inspector and the console. I've always wanted to explore it myself, but I'm usually deep into another project.)
I wonder what I could have done if I had Three.js?
> IMHO re-implement these using modern ES6 javascript targeting browsers above IE11 (so ES module support is good) and a simple canvas library (or even P5.js) to really capture the original spirit of BASIC
IIRC, nothing in either volume of the original (not sure if this changed in the later update that targeted SmallBasic) used graphics, they were all text-mode, so there's no real need to target a canvas library. Maybe something that provides a simpler abstraction than the DOM for just dropping text onto the page, though, if you don't want all the display in dev tools.
B4X is a free Visual Basic-like environment that allows you to develop without cost for Android, Windows, Mac, Raspberry Pi, Arduino. The purchase of a license is required to develop for iPhone. There is a lot of free learning material, including videos.
Pick up any cheap $30 pre-paid Android smartphone at Walmart. Install Termux (while you still can). Use a nice keyboard for coding like Codeboard: https://play.google.com/store/apps/details?id=com.gazlaws.co... Or add a simple bluetooth keyboard to pair with it.
The Raspberry Pi 400 is almost there. You wouldn't always get a VDU with a micro back in the day, either, so it's pretty close to what many of us had. Plugs into a TV, so it's a very similar experience.
When Amazon has their Fire tablets on sale, you can make a $60 tiny laptop. Or "laptop" if you prefer. ~$27 for the Fire 7. ~$25 for a Zagg hinged keyboard case. Spend 30 minutes removing the Amazon annoyances from their version of Android. Install Termux. Install Brave (this is the one Android browser I've found with full KB support). Not quite a full-featured computer, but maybe close enough depending on your purpose.
You can get ~$200 pi 400 + touchscreen deals. That's a lower nominal price than anything but firesale deals on 80s PCs without displays were, and a lot cheaper in real (adjusted for inflation) terms.
Sub $100 would be nice, sure, but it's not like what we have available today is bad.
With some of the discussion recently about Fabrice Bellard, I was thinking a nice retro, minimalist PC OS could be made with TinyC, QEmacs, FFMpeg, TinyGL, TinyCore Linux, etc. I'm sure a lightweight Basic implementation could be found to complement those.
I highly recommend messing around with yabasic[0] a bit,
runs on windows and (probably) most unix-likes, and even offers graphics capabilities right out of the box!
I feel like this would've been a great batteries-included environment to start in, back when I started programming.
[+] [-] fuball63|5 years ago|reply
- I remember when I started, using BlitzBasic, I had a really hard time understanding the concept of arrays.
- A friend of mine, when showing him the statement 'x = x + 1' was confused; surely, x cannot also equal x+1.
- When teaching Python, the concept of function parameters and variable scope is always a struggle.
To some degree, having spaghetti code and all globals is useful for teaching because it 1) gets people excited to program and see something working and 2) demonstrates why you don't want to do those things. I remember when trying to write my first text based CYOA game, I was so excited to add content to it and see it on screen, but also learned very quickly that having to scroll through 20 pages of if statements was not fun, and why functions would help. I'm not sure if someone explaining "encapsulation" to me would have really taken root.
I think there should be a rewrite of the book, for modern languages and development environments, but keep the complexity extremely low, like 70's BASIC was intended.
EDIT: Just looked at https://github.com/coding-horror/basic-computer-games/blob/m... , it actually looks like a pretty good blend of original but with mild improvements.
[+] [-] Jtsummers|5 years ago|reply
While I'm certainly no fan of spaghetti code, I think this is an important kind of experience for novices. I, for example, let mentees at work go down a wrong/weird path with their code for a couple weeks when I see bad code patterns or poor choices in algorithms/data structures in order to give us something to discuss and correct later when they start to hit pain points that I, usually correctly, predict they'll hit. I let them know that they're making their life harder, but I don't direct them to change course (some do on their own, others don't). Telling someone who's just learning how to do things the "correct" way (to the extent that there is a singular correct or a small set of correct options) doesn't give them sufficient motivation and experience to actually learn and internalize it. Often you get a kind of cargo cult mentality around the things you teach them since they lack comprehension of why those are good ideas or better ways of organizing code or whatever, or a later rejection of what they're taught because they don't understand the motivation behind it.
Also, letting them go down the path of spaghetti code or confused structures gives an opportunity to teach them refactoring techniques, which even expert programmers still have to apply to systems they develop (most people don't write perfect code on the first pass, and most systems having changing requirements which would render the perfect code imperfect if they did).
[+] [-] krisgee|5 years ago|reply
I think the best thing that my CS 101 prof did was always refer to the assignment operator as "gets" so you'd say "eks gets eks plus one" out loud. It really helped divorce assignment and equality in my mind.
[+] [-] retrac|5 years ago|reply
Some people say a language like Haskell would be no harder, and maybe even easier, for someone with no previous programming or CS experience, than something like C or Python. Comments like that make me wonder if they're right!
(Haskell is a pure functional language. And so has the same reaction as your friend. Variables are immutable. Anything else would be madness.)
[+] [-] njharman|5 years ago|reply
When teacher was explaining equations first time. I thought, "this is easy, its just like programming".
[+] [-] Mountain_Skies|5 years ago|reply
[+] [-] zxcvbn4038|5 years ago|reply
[+] [-] dehrmann|5 years ago|reply
[+] [-] trestenhortz|5 years ago|reply
I’d forgotten just how confusing those initial concepts like arrays could be.
[+] [-] fractallyte|5 years ago|reply
http://www.bekerbots.com/
[+] [-] koalahedron|5 years ago|reply
They were an essential part of the book, for engaging your imagination. They were also a gateway to books like Heiserman's "How to build your own self-programming robot":
https://archive.org/details/howtobuildyourow01heis/page/n5/m...
[+] [-] JKCalhoun|5 years ago|reply
[+] [-] AlSweigart|5 years ago|reply
Hi, I'm Al Sweigart. I wrote Automate the Boring Stuff with Python. My next book (working title The Big Book of Small Python Projects) is exactly what Jeff talks about in the article. I started on this three years ago, and the style of the programs are 1) short (under 256 lines, as an arbitrary limit) 2) text only (so that readers can link cause-effect between the print() calls and the text that appears on the screen 3) requires no additional libraries outside the standard library 4) fits in one source code file for easy copy-pasting, along with some other guidelines.
My main fear is that I'm just old, and I'm mistaking the nostalgia of how I learned to program for good pedagogy in modern times (this is a mistake the One Laptop Per Child project made). But I figure this might be a good start for beginners who want to see what programs "look like". I already have JavaScript, Java, C#, Kotlin, and Go versions also planned. The books, like all of mine, will be released under Creative Commons licenses. The first book should be out in a few months.
[+] [-] buescher|5 years ago|reply
[+] [-] HenryBemis|5 years ago|reply
[+] [-] macjohnmcc|5 years ago|reply
[+] [-] koalahedron|5 years ago|reply
http://www.trs-80.org/trs-80-programs-32-basic-programs-for-...
I really liked "The Flying Walloons", simple as it was.
Here's one I never saw but would have been fun, I think:
http://www.trs-80.org/trs80-graphics/
I remember I had to hide them in my other books because kids would pick on me if they saw "nerdy" books like this, and teachers didn't like you reading anything interesting during their boring lectures.
[+] [-] qbasic_forever|5 years ago|reply
[+] [-] koalahedron|5 years ago|reply
It's kind of like discovering the assembly monitor on the Apple ][, which you could get to by poking a value in Basic. I remember typing in an assembly program I found in a magazine that sampled audio from the cassette recorder, and played it back on the speaker. It was gritty sounding, but an amazing discovery for me at the time (about 1982).
(I'm always doing Ctrl-Shift-C to copy text from the browser when I forget I'm not in the terminal anymore--which brings up the element inspector and the console. I've always wanted to explore it myself, but I'm usually deep into another project.)
I wonder what I could have done if I had Three.js?
[+] [-] dragonwriter|5 years ago|reply
IIRC, nothing in either volume of the original (not sure if this changed in the later update that targeted SmallBasic) used graphics, they were all text-mode, so there's no real need to target a canvas library. Maybe something that provides a simpler abstraction than the DOM for just dropping text onto the page, though, if you don't want all the display in dev tools.
[+] [-] xNeil|5 years ago|reply
Any help is really, really appreciated.
[+] [-] _joel|5 years ago|reply
[+] [-] adamredwoods|5 years ago|reply
There is a dialect called CerberusX that 's still alive (and I helped make a VSBasic extension for it): https://www.cerberus-x.com/community/index.php
[+] [-] buescher|5 years ago|reply
[+] [-] bikenaga|5 years ago|reply
[+] [-] fuball63|5 years ago|reply
[+] [-] Zuider|5 years ago|reply
https://www.b4x.com/
[+] [-] amelius|5 years ago|reply
[+] [-] qbasic_forever|5 years ago|reply
[+] [-] UncleSlacky|5 years ago|reply
[+] [-] dunnevens|5 years ago|reply
[+] [-] dragonwriter|5 years ago|reply
Sub $100 would be nice, sure, but it's not like what we have available today is bad.
[+] [-] njharman|5 years ago|reply
I think there are keyboards with space for raspberry. To replicate the c64, trash80, appliED, TI94a experience.
[+] [-] koalahedron|5 years ago|reply
Fabrix?
[+] [-] koalahedron|5 years ago|reply
https://github.com/koalahedron/lisp-computer-games
Man that brought back the memories, and I had a blast doing it. Many thanks to Jeff Atwood.
[+] [-] koalahedron|5 years ago|reply
[+] [-] bananicorn|5 years ago|reply
I feel like this would've been a great batteries-included environment to start in, back when I started programming.
[0] http://www.yabasic.de/