Why Basic is Still Relevant
kidbasic.sourceforge.net
kidbasic.sourceforge.net
Smalltalk is a tiny language, with the entire syntax famously fitting on an index card. It is pure in theory: everything is an object and every operation, even "1 + 2," a message sent to an object. It is also pure in implementation: except for a handful of primitive messages, Smalltalks are written almost entirely in themselves, like Lisps.
That a developer could, in 2009, be completely ignorant of the advances made in his field a quarter century earlier is simply inexcusable. To see people, in 2009, touting BASIC as a fine pedagogical tool (and not a modern incarnation, but classic line-oriented, GOTO-ridden BASIC--the very BASIC upon which Dijkstra unleashed his rancour), and to see others seriously suggesting Ruby, Python or some other overly-complex bastard child of C instead, is to observe first-hand the tribute that ignorance exacts from the ignorant. And that ignorance is not only the cause of BASIC being inflicted on yet another generation of hapless youth, but is also the reason why C#'s classes aren't real objects, why Java's "new" is a special primitive, and the source of countless over incongruities between Smalltalk and nearly every other language advertised as "object-oriented."
p := Pen new.
360 timesRepeat: [p go: 1; turn: 1].
that will draw a circle.
4 timesRepeat: [p go: 100; turn: 90].
and that, a square.
More complicated stuff can be done with Morphic and eToys.
This is a valid point, but there is a huge change that here that we seem to be missing. When a lot of us started out, computers were not ubiquitous. Getting a computer to print out "trjordan is the BEST!!!!" in a loop was insanely cool, because that's what computers did. The reason BASIC seemed so great was because you could make computers do what you thought was their primary use (text-based input/output, and decisions based on your input).
Today, kids have a totally different relationship with computers. I can't claim to understand it, but the sheer pervasiveness of graphics, color, and mouse-based interfaces changes how kids work with computers. When you think of it this way, BASIC, Python, and every other programming language falls short, because you basically can't create things that ape real programs (interface, no logic) in a few short lines. Sure, Python is great for some kids, but it's not hooking anybody whose mind isn't already "wired for programming", in some sense.
So what's the answer? I'm not sure. I do think that we need to provide something to get GUIs and graphics in front of them in a fast, easy, and intuitive way. LOGO's turtle is OK, but ultimately too limited. I remember _why's Shoes seemed like a step in the right direction. Kids love building things, and programming are only endeavor where you are only limited by your imagination. With the right set of tools, they could get start on a lifetime of building, but they need to be shown how powerful that keyboard and monitor are.
Sure you can, c.f. STOS/AMOS, GFABasic, BlitzBasic/BlitzMax, GameMaker, AGS and all the other BASIC-like systems that make it a breeze to program games and GUIs.
With BlitzMax (which is relatively modern), you can get GPU-accelerated sprites flying around on screen in three or four lines. Easier than Flash by a long way.
When starting out in programming it's important for it to be as least abstract as possible. It's basic usability. You want to do something and see the result immediately.
1) I agree that this can give kids a good understanding of how a computer works... but at least with QBasic there are functions so some teachers will be tempted to not teach GOTOs.
2) Kids don't care. As @trordan mentioned, anything command line will seem boring to kids nowadays.
However, I don't see any reason why you can't have a programming language which is, in some sense, a "high level low level language" and still can produce neat graphics. I don't know if it exists though...
While it was impossible to do anything advanced in it (without using dll-files), it was really easy to make a simple game with it.
The current version of the language is outdated (uses directx 7 for graphics, no hardware acceleration, etc.), but a new version is in development. The language is made by a finn and does not currently have official english manual, but the next version is supposed to have (there are some translations made by the community).
anything command line will seem boring to kids nowadays
Not quite. Remote control, for example, will always have its appeal - that you do something in one place that causes something to happen in another apparently physically disconnected location. So if what the command-line controls is "distant" enough, it'll be fun. I don't intend to say that command-line is the ideal interaction mode, but it doesn't need to be thrown out of the toolbox just yet.At some point, my dislike for Basic brought me to the question: "What language is appropriate to use for introducing kids to programming?" Of all of the other languages I know, none seem appropriate. (And yes, people have suggested Python, but I'm not convinced.) Languages designed for children are dumbed down. Languages designed to meet the rigor of modern programming requirements have complexities that should be hidden for relatively simple operations. Sigh. I'm sure there is a better way out there, but to find it within the haystack that is the collection of modern programming languages is a formidable task.
I would think it is easier to program in python because of the for each syntax in python since it maps so closely to human language. For element in list: do something with that element. To open up a file it's just myopenfile = open("/path/to/file") etc....
Line number based BASIC is much easier for a child to understand. You start at the top, and start reading. I remember that in my head I had an image of me writing 'stories' for the computer to read.
A (very) few years later, the question of order of execution was obvious to me, but I clearly remember those times in the lounge room looking at print outs of Pascal, and not being able to figure out what the program was going to do.
Sorry. Couldn't resist.
That said, I think we may be confusing two things: teaching computer science and teaching about computers. To the compsi approach, you would want something that can express the rich, high-level concepts
OTOH, if you want to teach how a computer works deep inside, BASIC, with GOTOs and one-line IFs, primitive types and so on teaches a lot about how the processor inside the computer thinks, without the fuss other languages bring. Creating your own recursion (building your own stack - or stacks - out of arrays of primitives) is a worthy exercise.
I learned how to program with an Apple II. It didn't kill me.
Twenty something years later, I don't think the experience left me with any scars or bad habits, but I might not be a programmer today if I hadn't started with BASIC.
Maybe the BASIC you used couldn't be entered from the command line, but you could type BASIC commands into the Commodore 64 directly, without having to write a program first, and they would be executed. This has nothing to do with it being interpreted or compiled.
http://www.virtualapple.org/dungeonmasterdisk.html [fun game]
run this program, hit ctrl-c and type
print "hello world";
http://www.virtualapple.org/overrundisk.htmlBut when I was a kid, that never felt like a "real" program. The real .EXE and .COM programs were compiled and ran straight from the DOS prompt, and I wanted one of those.
You're right, I had friends with C-64s and Apples. For the C-64, BASIC was basically the whole "interface." Running a program involved running a BASIC LOAD command. Not so on the early DOS clones.
However, if I was going to teach something about programming to a novice I'd try to get them to start thinking functionally from the beginning. All this imperative crap is how you implement the abstract model of what you are trying to compute on the hardware. Why get bogged down in the details? Show them a recursive data structure or algorithm and get them to understand it. Have them run it on paper not by thinking about what registers or variables you are modifying, but rather what the expression tree looks like when the recursive algorithm is evaluated.
I think if my first language had been SML or a LISP I'd have had an easier time later on in my programming career.
Functional programming is a good paradigm but not a panacea, and imperative programming isn't crap. It has its uses. I like FP, but sometimes I'm embarrassed by how some people put it on a pedestal, like for OOP before...
It should be noted that MIT switched the language they teach their undergrads this year to Python. It should also be noted that Python also has roots in Lisp.
If that is so, I can hardly distinguish them anymore.
From one direction, come at them with microcontroller assembly language. Get them making Arduino-powered blinky LEDs and robots. That will learn 'em the fundamentals and should be a blast from the beginning.
From the other direction, use HTML+JS to teach high-level dynamic languages and GUIs. Plenty of fun to be had here as well. They can code up their own social sites. You might want to grab some equity.
These two courses together would be intense but they are so different that they can use one as a refreshing break from the other. They are both so dense with gratification that if you've got a real future hacker on your hands, you'll be the one who has a hard time keeping up.
Then there are things like squeak or Alice that are aimed at providing a gentle and fun introduction to programming.
Learning basic is certainly preferable to learning nothing, and like a great many people here I also was introduced to programming through it. But as far as I can see there is little to no reason to consider it a preferable introductory language.
http://www.parallax.com/tabid/407/Default.aspx
The Parallax Propeller is an 8-core microcontroller (with each core named a "cog") with very small amounts of memory on each core. The Propeller can fairly easily interface with PS/2 keyboards and mice, VGA monitors, and RCA Composite screens. You can code on it with ASM, a language with an onboard-interpreter called SPIN, some free but proprietary-and-slightly-limited C compilers, a tiny implementation of Basic that works, or a very robust Forth.
Give it to the kids in your life, and they too will be able to write "Ian Rules!" :)
Without any instruction, apart from two tutorials from YouTube, he has made a number of exploratory programs.
I cannot recommend it more highly then seeing him dancing in delight as he showed his mother how the flying bit of doodle (made with the in-skin paint widget) that shoots from the mouth of the cat makes the stick men 'ghost'.
He set up broadcasts, loops, events, and keyboard control, all on his own.
I'm not sure BASIC captures the imagination of kids these days. _why's Shoes does a much better job.