Writing in Salon, David Brin (yes, that one) asks why Johnny can't code. His son apparently still learns from maths textbooks so old that they have sections at the end of each chapter titled "try it in BASIC", with short programs illustrating how to solve mathematical problems as well as teaching the rudiments of programming.
"BASIC?" I hear some of you ask, "What's that?"
BASIC, short for "Beginner's All-purpose Symbolic Instruction Code", is a programming language from the dark ages - after we'd figured out that you didn't need to code everything in ones and zeros or switches on a panel, but before we'd decided that procedures were the way to go (objects being not even a dream back then). It had line numbers and handled everything by sequential processing, with the ability to jump around the program with statements like "GOSUB" and "GOTO" (the latter now considered harmful and eliminated from all serious programming languages). The important point is that from the early 80's, every home computer shipped with a copy of BASIC, which you were forced to use if you wanted them to do anything. So thousands of children got their first taste of programming with "programs" such as this:
10 PRINT "IDIOT IS COOL!"
20 GOTO 10
(The eyes! The mouths! The tentacles!)
This seems to have been a universal experience among people of a certain age who had any contact at all with computers. Most then got bored and wandered off (or learned how to load games) - but some stuck at it and learned the basics of how to tell a computer what to do (and that it would do exactly what you told it to - no matter how stupid), which then provided them with a good grounding (as well as some bad habits) when it came time to learn a real programming language in later life.
Brin's problem is that children just don't get this experience any more. No computer ships with BASIC or any other comparably simple programming language as standard (and no, the Microsoft Visual Basic built into Word doesn't count, being both inaccessible to most people and a bit too complex as an introduction). In the end, he bought an old Commodore-64 over the net to ensure that his son could "see the lines that weave through the fabric of cyberspace" and get a basic grasp on how computers work "under the hood". But this is obviously an far from perfect solution, and instead it would be far easier if every computer had a toy language in a sandbox built into its operating system so that children can learn the basics. And it certainly seems like a good idea, given the increasing importance and ubiquity of computers in modern society...
There are lots of opensource languages.
ReplyDeleteIt wouldn't be hard to offer a language (Javascript? VB?) on a web page - I'm sure this must have been done somewhere.
Although for simple maths, I'd suggest Excel - I use it whenever working out anything computational. For advanced maths, Mathcad I suppose, but I've never used it, not being a mathmagician.
give johnny a copy of MIRC and tell him he needs away messages and so forth.
ReplyDeleteAnd in the long run that it is fun to run EVERYTHING through the programme. (ok crazy but hey)
I'd point out that while it's possible to get a computer without an operating system, as soon as you install the OS, you invariably get at least one programming language with it.
ReplyDeleteEven Windows 2003 still has a command line interpreter that can run .bat files, and all versions of unix come with a shell script engine of some form.
Not the best as a learning tool, admittedly, but for that you can download Ruby, Java, Eiffel, Jade, or even Logo, for free, complete with free development environments such as Eclipse.
I think that artiicle just shows that David Brin is either nostalgic for the BASIC days or knows far too little about modern computers, and he obviously knows nothing about teaching programming!
Why the hell would you want a _line_based_ programming language to teach children? For newbies, that is actually harder to understand than simple OO programming.
"Lined" programs are an artifact of the lack of good UI technology and development environments, they're basically a hack to help programmers find their way around large programs you couldn't sdee the whole of on the screen at one time, and the fact that we didn't have scrollable text windows at the time.
I'm inclined to agree here. BASIC is a truly horrible language to learn with; I know, I did it myself. As has been said, there are very many open-source languages available for download, even BASIC implementations for those who want them. Or get a copy of QBASIC from an older system.
ReplyDeleteI don't really see this as a problem; what's wrong with downloading something? Even better, downloading more than one, so they can experience multiple varieties and styles of programming.
My spouse had the (I think) rather mean idea of setting the tv up so our daughter would have to write a little programme every time she wanted to watch it.
ReplyDeleteI agree totally. I learnt much of what I know about computer and information systems from a free Commodore PC 5 given to me by a kind neighbour in the early 1990s.
ReplyDeleteI'd say the same is true of cars, and mechanical skills in general as well. It is next to impossible to tinker with a modern, post 1980s engine. More computers than mechanics really.
There's a quote from Edsger Dijkstra which might be worth mentioning here...
ReplyDelete"It is practically impossible to teach good programming style to students that have had prior exposure to Basic; as potential programmers they are mentally mutilated beyond hope of regeneration."
I'm not convinced that he was joking...
Buff
I have pondered this issue for some time.
ReplyDeleteIn response to this article I have seen people suggest python, ruby, Javascript and a variety of wierdass little things. Wrong Wrong Wrong! They all do too much, and often simultaneously too little.
10 print "thing"
20 goto 10
6 elements, that almost any person can understand. Line numbers are not really needed.
Start:
Print "Thing"
Goto Start
Is just as understandable. More lines but one element fewer.
The main problem that I have is that there is no concept of the complete system anymore.
I remember learning assembly language, and seeing that the basic interpreter was implemented in that assembly language.
I have often felt that some sort of assembly should be taught. It builds a perfect foundation. By its very nature assembly code is easy to learn, but very difficult to do things in. This makes people understand what interpreters and compilers do and why you want them to do it.
You really need a virtual computer (a spectrum or c64 emulator may be the thing) if you want to have a learning experience on a modern system. It's no use having something where you use an API where all of the stuff happens magically. On the c64 it was possible for a inquisitive user to figure out how the basic PRINT statement works. The steps that occur to print a line of text in a window are way to complicated to follow (window handles, device contexts, scalable fonts, graphics drivers)
Part of this is a problem of the modern world. There are are an increasing number of things where maybe only a tiny number of people know how they work inside. Condider opening a childs toy from 50 years ago to see what makes it tick, compare that to opening a modern day childs toy to see what makes it go 'I fancy the drummer'.
One of my long long term projects may end up addressing the programming problem. I have spent a long time thinking about what is needed and one day I'll get it finished, Anyone want to lobby the govt for funds for open source projects :-)
Bash (comes with Linux):
ReplyDeletewhile true
do
echo "YOU R TEH SUXORz"
done
Python (comes with Linux):
while 1:
print "STEPHEN RULZ!!!!!"
Javascript (in your browser):
while(true) { alert("Stephen RULZ!!!"); }
Most versions of Windows still ship with VBA.
But anyway, what about Logowiki http://www.logowiki.net/
stephen:
ReplyDeleteA first introduction to programming shouldn't include while.
You've started with a boolean expression (albeit a constant one). The very notion of while suggests non permanancy.
I'd bring in while after introducing.
If x THEN GOTO
"what about Logowiki"
ReplyDeleteCrashed my browser, thats what
If you want quasi-assembly, you get Parrot. Or any of the myriad of other virtual machines (it's perfectly possible to write JVM or .NET assembly too). I, to be honest, wouldn't want somebody experimenting writing real assembly on a system I cared about.
ReplyDeleteBASIC does teach terrible programming, and I'd really prefer that people not use it to learn with. Even Pascal is better, although it's pretty unpleasant to write in.
When I took a sixth form programming class (to fill in some space in my seventh form year), the teaching began in an abstract, invented language, designed so it could be simulated by a person. It just had basic input, output, arithmetic, and conditional structures. I think that's a better way to go about it.
It's simple enough that an interpreter can be whipped up in a few lines of any real language, so that it can move on from manual simulation pretty soon (it's only about twenty lines of Ruby for a very thorough implementation).
I specificly used the term Virtual Computer because virtual machines as they exist are distinctly _not_ what I was wanting to have. Wrong tool for the job again.
ReplyDeleteYou need to have an entire computer emulated if you want to teach an appreciation of the overall system. A C64 Emulator is closer to what I'm talking about although for a teaching aid, a more simplified architecture would work better (raster interrupt driven sprite multiplexing isn't really a requirement anymore)
People say that BASIC teaches terrible programming. Yet the generation of programmers that have come though having missed BASIC seem to be at least as terrible overall. I havn't seen any real evidence to suggest learning basic causes long term problems. It'd be impossible to test for since you can't really rate how much BASIC a person knows and terrible code is, to an extent, subjective.
There's not much point in teaching actual assembly to start with; that's a sure way to turn people off. I don't even think that Parrot assembly is a good place to start (even PIR is dodgy).
ReplyDeleteYou can, of course, get entire virtual systems if you want them. I just don't think anybody does beyond the level of that manually-simulated language I described. The problem really is that it's just not possible to understand any of the mechanics behind something that's actually in use any more without knowledge a lot more advanced. Better to learn programming practice, algorithms (of sorts) and the like, which can be done in any language you choose.
I guess working with an actual system that's simple enough to look at the assembly has merit; it just has no practical value any more. Assembly has become a late-if-ever part of the process, in part because code actually in use is generally so complicated. The case of your interpreter being written in assembly doesn't come up either.
For low-level operational development, a virtual machine works just fine. You only lose out on actual hardware interaction, which is pretty unpleasant on commodity boxes anyway.
I began in QBASIC, and I wrote some very complicated code in it, which was a lot of fun and taught me a lot. A lot of what I learnt was some pretty bad coding practice though, GOTO being a part of that. It took a lot of work to stop writing like that in other languages (moving on to VB didn't help with that). Like the saying goes, "A good FORTRAN programmer can write FORTRAN in any language".
Pascal is a better place to start actual programming, and there are free (gratis) implementations available. It's not that BASIC doesn't have a place, but if there's another option, take it.
posting again, sorry, but this is my thing.
ReplyDeleteOn a simple architecture system you can actually achieve some reasonable results with simple assembly programs. If you are not contending with an operating system things are quite easy. (just look what can be done in a 256 byte com file)
The problem arises if you start to do anything more complex. That is hugely important. High level languages are a solution to a problem that beginners haven't encountered yet. Give them the problem before showing them the solution
Pascal is my language of choice and I have tutored a child using it, but there is too much that needs to be taught simultaneusly to introduce a simple program. The student ends up copying portions of code verbatim without knowing why.
It seems to be a common assumtion amongst people approaching programming for the first time, that each line of a computer program causes the computer to do something. I have seen people struggle with the concept of a type definition because it isn't an instruction for the computer. It's setting up the context for future instructions. Once again structured types are a solution to a problem where it is very difficult to wrap your head aound the idea if you haven't run into the problem.
One day I'll actually get a chance to properly address this. [hopes]
It's true that with a simple system you can get results with assembly; I just don't think that it's productive to learn direct access to the hardware. And if you're not doing that, there's no benefit to actual assembly over (say) PASM.
ReplyDeleteIf they're copying code without understanding it they're moving too fast - but that's also where the pseudocode way is a good place to start, because it forces you to understand what you're doing.
I always saw type definitions as "create this" instructions.
I agree with Stephen - give them a linux box and teach them bash scripting.
ReplyDeletePersonally I'm more into web based languages. PHP is my poison of choice. Haven't totally got my head around XML yet, but then again I haven't made a concerted effort to sit down and do anything other than read the W3C specs for it.