Should we miss BASIC?

Over in my post accepting my victory as the biggest geek on ScienceBlogs, an interesting discussion about beginners learning to program got started in the comments. It was triggered by someone mentioning David Brin's article in Salon about how terrible it is that computers no longer come with basic. The discussion was interesting; I think it's interesting enough to justify a top-level post.

A few days ago in Salon, David Brin published an article (no link, because Salon is a pay-site), lamenting the fact that computers no longer come with BASIC interpreters, and how that was going to wreck the next generation of up-and-coming programmers:

>Only, quietly and without fanfare, or even any comment or notice by software
>pundits, we have drifted into a situation where almost none of the millions of
>personal computers in America offers a line-programming language simple enough
>for kids to pick up fast. Not even the one that was a software lingua franca on
>nearly all machines, only a decade or so ago. And that is not only a problem
>for Ben and me; it is a problem for our nation and civilization.

Yes indeedy, the lack of built-in BASIC interpreters is a problem for our very civilization!

There are two contradictory threads running through the article. One is the idea that "back in the good old days", everyone had the same programming language, a "lingua franca" which everyone spoke. The other is that the "line-oriented" BASIC was a better tool for beginners learning to program than anything that we have now.

I think both of these are utter nonsense.

--------

Let's start with the "lingua franca" idea: BASIC was never *one* programming
language; it was a family of loosely related programming languages.

I first programmed BASIC on the TRS-80 model 3. Then I bought myself a Franklin
Ace (an Apple 2+ clone which was considered very cool at the time because it was
color and could do *lower case*). An astonishing amount of what I knew went
*right* out the window. In fact, I don't think that *anything* beyond:

10 print "I'm a dope"
20 goto 10

would work on both. In fact, there were *two* basic interpreters on my Ace; "Integer Basic" and "Advanced Basic". Even aside from the fact that integer basic couldn't do floating point numbers, they were very different languages. Just one example I remember: the "IF" statement in integer basic was "IF *cond* THEN *linenumber*"; in Advanced Basic, it was "IF *cond* THEN *statement*".

My point, such as it is, is that there never was a single language that we all shared. Not in any meaningful way. There were the basic structural similarities - all used line-numbers, all put "$" on the end of string variables. But no non-trivial programs could actually be copied from one computer to another. I know; I remember reading Dr. Dobbs, and seeing a cool TRS-80 program, which I wanted to be able to run on my Ace, and I couldn't figure out how to make it work. The two BASICs were just too different. I had the same experience numerous times.

That wonderful era of the single common programming language that Brin invokes never existed.

Let's contrast that against today. I'm primarily a Mac user, but I also use Windows-XP and Ubuntu Linux. On all three machines, I have Python and DrScheme. In either language, I can take a piece of code that I wrote on any of the three, copy it, and run it on the other two with no changes. I can grab Python code from magazine articles, from internet posts, from just about any source I want, and run it on all three machines. Back on the old home of this blog, after I wrote about Minsky machines, I posted a little Minsky interpreter written in Scheme. *Thirty thousand* people downloaded it. My little Minsky interpreter, written in very basic standard Scheme, runs on my mac, my windows machine, my linux machine, my PDA. I can *almost* run it on my *cellphone*. (My cellphone has a JVM built in; I don't have quite enough memory to run a Scheme interpreter.)

------------

Brin's second argument is even worse. The idea that there is something specially good about BASIC because it's "line-oriented" is silliness. I *think* that what he's getting at is really *interactivity*: that you can type programs on the fly, and poke around and experiment by just typing statements without line numbers.

Interactivity is a great thing. There is absolutely no doubt that especially for a beginner, the ability to do things interactively - to poke around, try expressions, probe the state when something doesn't work as you expected, etc. But BASIC is far from alone in being an interactive language. Python, Scheme, Squeak, Ruby, CommonLisp, and JavaScript are all ubiquitous, free programming languages that have *at least* the interactive capabilities of BASIC; most of them have considerably better interaction capabilities.

When you're ready to move on from the ultra-beginner stuff, languages like Python, Ruby, and Scheme are *much* better languages for developing larger applications than BASIC; and the skills you acquire using them are much better building blocks for programming in other languages than BASIC.

You can also move on from the beginners languages much more easily on modern machines. Anyone can get a complete Java programming environment for any platform they want. C/C++ is free and trivial to get running on Macs and Linux; it's a bit harder on windows (because the compiler is not free), but instead, you've got free C#.

My point is that powerful, interactive, portable tools are free and easy to obtain. The overall environment is *far* better for beginning programmers today than it ever was before. Todays computers are *better* for beginners, with easier to learn, easier to use, more portable programming languages.

I think that Brin's column is mostly just nostalgia for the way that he learned to program, combined with frustration over the fact that his children's (clearly out of date) schoolbooks include BASIC programs that he can't run.

More like this

Ah yes, I remember it well. "Hammurabi, Hammurabi, I beg to report to you, In Year 1, 0 people have starved. 101 people came to the city The population is now 124 We harvested 4.5 bushels per acre We planted 998 acres of wheat But rats at 300 bushels of wheat You now have a surplus of 1443 bushels…
While I was waiting for stuff to install on my new machine, I was doing some browsing around the web, and came across an interesting article at a blog called "The Only Winning Move", titled [Scheme Death Knell?](http://theonlywinningmove.blogspot.com/2006/10/scheme-death-knell.html). It's not a bad…
Draw your pocket protectors, it's a geekout! Janet, our lovely resident ethicist has challenged all of the ScienceBloggers to [a geekout][geekout], to determine who, among us, is the geekiest. How could I, a *math* blogger and computer language geek, pass up such a challenge? (Incidentally, Janet,…
In real life, I'm not a mathematician; I'm a computer scientist. Still a math geek, mind you, but what I really do is very much in the realm of applied math, researching how to build systems to help people program. One of my pathological obsessions is programming languages. Since I first got…

Salon has a daily ad that you can click on, then alt-tab to another window while it's playing, then alt-tab back to enter Salon. It doesn't get you into some advanced stuff, but you can read the articles.

Excellent post. I couldn't agree more and the last sentence tickles me greatly. :)

I do think there is a qualitative difference between people who come into (say) college or graduate school now "computer literate", and people who were "computer literate" back in the good old days when we were kids.

Kids who know how to use computers now, by and large, know how to use a word processer, the Internet, instant messenger programs, media players, and the like. The really advanced ones know how to use a spreadsheet. Some artistic ones are a whiz with something like Photoshop or the Gimp. All of which is great. But, very few of them know a damn thing about programming.

Back when we were kids, the kids who knew computers almost by definition knew programming. Yeah, you could have your Apple II or C-64, and use it only for games and word processing and the like. But the kids who were the computer kids did play with those built-in BASIC interpreters, and did learn something about programming a computer; not just configuring a pre-existing software package to look the way you wanted it to, but really to think through the logic of getting a comptuer to do the things you tell it to.

Nowadays, in my observation very few students come into graduate school knowing any programming at all. Back in my day, nearly all of the first-year graduate students knew some, and by and large were better at it than their advisors. But now, they're used to having a quite robust infrastructure of software to get done the things they want to get done. "Playing" with a computer no longer means playing with programming; it means surfing the web, downloading music, chatting with your friends online. I don't think any of this is bad, but I do think it's too bad that we don't have the same kind of built-in incentive for kids to learn programming, because it still is important.

-Rob (who wants to teach a 1-unit course entitled "getting shit done with Unix and Perl" (or perhaps "... and Python") for first-year grad students)

(or perhaps I should sign : -Rob (not as nerdy as Mark, but second place!))

I think you are arguing right past him.

While *your* point is that good tools are easy to obtain, I think *his* point is that they used to be part of the package and in some ways part of what you wanted when you bought it. I know when I got my first computer the fact that the operating system essentially had an interactive programming language as part of its command shell meant that I was programming from the get-go. Never mind that my second step was to reset into Monitor ROM and start programming by typing in 6502 hexadecimal opcodes.

He's right in that sense -- programming is carefully hidden now even on systems that have a diverse selection of languages available out of the box. It used to be part of the initial experience of the user. That's probably partly because programming is why we bought computers in the first place, which is now far from true.

-Rob (who wants to teach a 1-unit course entitled "getting shit done with Unix and Perl"

Okay that made me laugh -- I teach a course with almost exactly that title here in my workplace. :D

Pulling my comment over from that other thread:

And if you have firefox, a full javascript read-eval-print loop with tab completion is just a click away after you install the javascript shell bookmarklet. (Where "install" means "go to that page and drag a link found there to the toolbar")

I wonder if there aren't kids out there right now learning programming by modifying greasemonkey scripts. That's just as accessible as BASIC or Logo was back in the day (though sometimes I miss the TI Logo II sprite editor; I know, I'm sick), and it solves the "interest bootstrapping" problem that people sometimes complain about with modern computers. (Namely, that there's such a huge gap between the command-line programs you can write when starting out and the GUIs people use every day that it's difficult to maintain interest) Tweaking some aspect of a frequently-visited website to your own personal preferences is something that has almost-immediate payoff.

Not only that, but it also has the wonderful payoff that Brin is alluding to there with his lingua franca babble: chances are, if you've written your first Greasemonkey script for the social networking website du jour, some friend of yours will use firefox and that website. This means that they can use your program (almost) right away, eliminating another problem sometimes faced by today's beginning programmers - programming may not itself be an intrinsically social activity, but having someone else appreciate your creation is unbelievably reinforcing. The need for budding programmers (and people in general) to show off their skill to other people is often overlooked.

Although we have a lot of nice languages available for free, Windows XP (I don't know about macs) doesn't come with one. Even MSDOS had qbasic. Kids need to run into these things by themselves. When my parents bought me my C64, everybody knew that it had Basic and games. Its user's manual taught basic and I didn't need to find anything on my own.

Rob, you know that the URL you're using for the comments is a dead link that doesn't actually go to your blog, right? That's the kind of stuff that can get your #2 nerd status pulled...

Also, it's interesting what you say about programming ability and physics graduate students. From what I heard from profs as recently as seven years ago, this trend has not been the case with mathematics grad. students - that is, they were still at that time seeing more programming ability on average over time. (although there you may be dealing with the gradual relaxation of a cultural disdain of computers that suppressed programming ability in grad. students of decades past)

I'm also extremely suspicious of the "kids these days" syndrome that will tend to color everyone's perceptions of days gone by, no matter how careful one is about one's observations. (Want a big disappointment? Rent a movie you remember enjoying when you were a teenager or slightly younger. Watch it now. I was so sad to discover how much The Dark Crystal sucked when watching it as an adult)

Do you have some external, not based on human memories evidence of this decline in programming ability among the physics grad. student population?

Do you have some external, not based on human memories evidence of this decline in programming ability among the physics grad. student population?

Before about 1999 we used to give priority to physics and chemistry degree wielders for programming jobs because they always had reliable programming skills -- most of them had to write device drivers to interface to equipment they or their colleagues designed for their academic work. That is, they programmed "to get shit done". Around 1999 that stopped paying off as a filter and instead we concentrated on eletrical engineers.

Interestingly, computer scientists have never been a big payoff for us at all when it actually comes to programming, though this is changing as current curricula in computer science are more and more becoming what trade schools used to be and are now cranking out large numbers of adequate Java programmers.

Has anyone yet mentioned that most OSs DO come with a programming language or nine?

Windows comes with VBScript and Javascript.
Linux comes with, seemingly, every programming language every written.
Mac... I actually have no idea. Hopefully it still has lemonade.

If the argument is that there isn't some native, simple language distributed with an OS, then I kind-of, maybe, sorta agree that this is unfortunate. It's not a great handicap with the wide availability free tools.

There is less motivation for kids to learn to program -- it's possible to do lots of interesting and useful things with a computer that don't involve programming. On my old Apple ][e, you either played "Sneakers" or you programmed!

I am bugged by school "technology" programs that are nothing more than "Word for Dummies." My kids got a little bit of Logo in the 1st grade and have had nothing but Powerpoint since then -- I'm not too happy 'bout that.

BMurray: I've found a similar track in hiring developers. Earlier, physics and chem majors were great, but no longer. Someone with an advanced CS degree might be ok, but they almost inevitably require extensive practical training. Just getting 'em to delete old files is challenge sometimes.

Should you ever need a free C++ compiler on Windows, Microsoft has a free version of their C++ tools (alongside free versions of C#, VB.NET, ASP.NET, and SQL Server).

I don't think that the lack of a "built-in" language is a big deal.

In the old days, *only* geeks got computers. The group of people who wanted to program were a very small part of the population; but they were pretty much equal to the group of people who bought computers.

Now, just about everyone has computers, but only a very small portion of the people who have them know how to program them. I strongly suspect that the group of people who learn to program today are pretty much the same as the group of people who learned to program then.

I'll agree that fewer physics and chemistry students really know how to program now; but I don't see that as a negative. A decade or two ago, if you needed a program, you had to write it yourself. So physicists and chemists who needed any kind of numerical analysis were pretty much forced to write their own programs. Now there are software packages that they use to do the computation. Personally, I think that's a good thing: as a computer scientist, I didn't want to spend my time learning semiconductor physics; there was so much to learn about my own subject that I regretted needing to take time away from it for other subjects. I would guess that many physicists and chemists felt the same way about programming. The ones who wanted to know how to program are the ones who still learn how to program.

Patrick, etc. : the mac comes with all the regular scripting languages (python, perl, &c.) as well as java, c, objective-c and so forth, its pretty much like every other *nix distro you are likely to use.

I guess my memory of programming my first computer is not that I had a language available. It was that I was *confronted* by the language. I couldn't *not* deal with it. Hell, one of my manuals was just the assembler listing for the ROM. The fact that the programming language in question was BASIC is unfortunate -- I learned some bad lessons in there, alone and fending for myself. The fact that it was interactive was essential though.

The thing is, you didn't necessarily know you were a real geek until you got that computer and the first thing you had to deal with was programming it. I don't necessarily think that can ever again be recaptured now that the vast majority of computer owners are not and never will be programmers and who would simply shelve the computer if the bar were raised that high, but I still suspect we lost some good programming minds in the bargain.

Was it worth it? Hell yeah. We bought 600 megabyte manager-constructed PowerPoint presentations with all this usability! With clip art!

I do miss my favorite BASIC command:
REMOVE X

By somnilista, FCD (not verified) on 20 Sep 2006 #permalink

Some of the easy interactivity I remember in BASIC is that it's interactive mode was also a debugger and editor. You could put in a STOP check or change some variables, and then GOTO the next line, edit the offending line, and save the program. Maybe it's something dumb to want, but BASIC's simpleminded IDE is enough to get you started.

I've only spent a few minutes with Ruby or Python, which certainly isn't enough to hold forth on what it can do, but for any interactive mode to be as powerful as the lowly BASIC, I'd like it to save and edit my work:

basica
print 2+3
10 print "hello world"
save "hello"
run
10 print "hello math!"
20 goto 10
list
save "hellomath"
run
^C
load "hello"
quit

Sure, it's lame. But those few lines are enough to get you over the first hurdles -- I could lead my sister through it over the phone, if basic was installed. And the rest is in the manuals. Ruby needs irb to be interactive, python needs an "import edit.py" to change objects. And how do you save your code? You're saying modern languages are at least as good as BASIC, but I didn't find the interactive program editing anywhere near as clear or even possible.

Seldom have I seen so many people talk past and through each other. . . I posted something on this two threads ago, but it got held for approval (thanks to a pair of URLs I had stuck in to cite my sources), and I don't feel like reconstructing it here.

Suffice to say I don't think any of the myriad free programming tools people have mentioned here and elsewhere in argue-about-Brin territory are as easy to get at as QBasic was in MS-DOS 5. . . or BASIC-XL on my sainted Atari 400. In other words, what BMurray said.

Your point, MarkCC, that there never was a single "lingua franca" BASIC is a good one. My gut and my programming experiences suggest to me that it is not, however, a vital issue. Before moving to Visual Basic 2.0 on Windows 3.1 (remember those days?) I used a hefty handful of different BASIC dialects: BASIC-XL on the Atari 400, with programs stored on cassette tape; a similar thing on the Apple ][e; GW-BASIC in early MS-DOS versions; QBasic in DOS 5 and above; PowerBASIC to make compiled executables, et cetera, ad nauseam. No two of these languages were exactly interoperable. A program written in one was almost guaranteed to fail in another, with either syntax or runtime errors. (The Q and Power BASICs were the most compatible, I recall. What's more, I believe both dialects allowed IF condition THEN statement and IF condition THEN line number as equally valid statements.) So far, I agree with you.

The flipside is that I don't remember having to convert programs between dialects very often! As long as sufficiently large sets of computers (home, school, Dad's office) all had the same DOS version, useful program X could run on all of them without modification. The point you raise is valid, but at least in my experience, a non-issue.

Hmmm. Could the solution to the out-of-date textbook problem be to redo those programs in PythonJavaFooScript? No, it's better just to call them obsolete, hope they go away and accuse anyone who says they might have been a halfway decent idea of spreading the killer disease nostalgia.

I recognize the kind of nostalgia that Brin seems to be expressing: I feel it too on occasion. I remember saving for an entire year to buy my first Atari 400 computer. At age 14, I read Creative Computing and Compute! I learned the mysteries of BASIC, then assembly code for the 6502. By the time I was sixteen, I knew the machine inside and out, and there was very little going on in the machine that I couldn't figure out. One of the cool things was that people talked about programming: magazines published programs. Books like Dewdeney's Armchair Universe gave you ideas of cool programs that you could write.

Fast forward to today. I picked an issue of Linux Journal today, one of the geekier mags around. But there aren't any articles about programming. The articles are all about using software that other people wrote.

That is a pity. But it isn't hard to understand. In the world of literature, there are far more readers than writers. So too, it is with programming.

When I finally emerge from my own sense of nostalgia, I recognize that we have gained far more than we have lost. If you want to learn to program, pick a language. Python is not a bad choice, and has a number of good introductory programming books. You can even write useful programs in it. Choose Perl if you like. Or Ruby. Or even PHP if you are really twisted. Common Lisp. Scheme. ML. C.

Just don't pick C++. :-)

Between open source and the Internet, learning to program has never been easier. I had to work for a couple of months to afford the Atari Basic cartridge. By comparison, downloading a Python distribution seems positively trivial. If that's the barrier, I suspect you need to question your own motivation.

I am teaching myself my first programming language now at 30. I am learning R for statistical computing. It is fascinating! I am really enjoying myself, but feel like I am a bit behind the curve. Hopefully, I can become fluent enough in it to translate my skillz to pick up other languages as well!

By E. Powers (not verified) on 20 Sep 2006 #permalink

All this being said, how do you start kids programming? Do you start with basic procedural stuff, or should we start somehow with classes and objects?

It is much like "new math" - introducing sets and things to get people thinking "math-like" instead of "number-like."

I think my programming abilities are crippled because I just don't "get" OOP concepts since I am so procedurely minded.

KeithB:

For starting kids programming, my choice at the moment would be Squeak Smalltalk.

Inside the Morphic universe, there's a pallette full of little graphic objects - circles, squares, drawing tools, etc. You grab things out of the pallette, and drop them anywhere on the desktop. Then in one click, you can open a scripting window, which lets you *graphically* write a script for the object. The script you write can do anything from changing the color of the item, to moving it around the screen, to collision detection. And when you outgrow the pretty scripting thing, you can gradually expand into full-blown smalltalk.

It even comes with some really great things like samples - a racetrack and a car, and the car has a script for figuring out when to turn; you can work on the script to make the car steer better and get around the track faster.

Smalltalk also has the property that (I think) Blake was talking about: it operates off of a saved universe, so anything you type, anywhere, can be preserved just by clicking "save".

I've watched 10yo kids with Squeak, and it's amazing to see how quickly they take to it. And I pushed a 50yo coworker to learn Squeak for doing some prototyping, and he loved it too.

Second place would be DrScheme, in the teaching mode. Doesn't have the immediately engaging quality of Squeak, but it's got plenty of other qualities.

Old Guy #1:
"Back when I was a kid, we had to know how to build our own radios out of toilet paper rolls and copper wire if we wanted to listen to Jack Benny"

Old Guy #2:
"Back when I was a kid, we needed to know how to rebuild a carburator to keep our Cadillacs running all night"

Old guy #3:
"Back when I was a kid, we needed to know how to write Basic programs if we wanted to do anything more with our computers than just play Wizardry"

As a kid, I had a book of BASIC games and my dad sometimes took me to the computer lab at a local community college where I would play with them and, incidentally, learn programming. In my sixth grade computer class, we learned a bit of BASIC and I still remember feeling proud because I completed the "print the numbers 1-10 in any way you want" in nine lines instead of ten by using a loop. (Yes, I was a geeky kid.) But by the time I took computers again in eleventh grade, we learned Word, HTML and Photoshop. Those things are useful, but they don't teach reasoning the way programming does.

What do people here recommend for learning to program again? And I'd really appreciate a self-teaching book that gets to the point without endless bubble diagrams of obvious concepts and doesn't presume I'm in a business environment.

Jane:

I've got two recommendations; they happen to be two of the best books on programming ever written.

The Structure and Interpretation of Computer Programs. *The* best computer science text ever. It's very nearly a perfect text. Covers a lot of material in a brilliant way. It'll teach you to program functional programs, object-oriented programs, constraint programs, imperative programs, and how they're all related. It's a book that I can still pick up, open at random and read a chapter, and find something new. Amazon link: http://rcm.amazon.com/e/cm?t=goodmathbadma-20&o=1&p=8&l=as1&asins=02620…

The Little Schemer. There's not enough good things in the world to say about this. Engaging, fun, deep, and silly. Just amazing. Amazon link: http://rcm.amazon.com/e/cm?t=goodmathbadma-20&o=1&p=8&l=as1&asins=02625…

for a kids programming language,

Alice is interesting
DrScheme
KPL (kids Programming language)

Theres lots of options...!

I think the good ol days of *having* to do basic are gone. Sure it was great for generating a generating of software developers, and it was good at the time, now computers are a much more general purpose tool and a lot more accessible to anyone. But it is interesting on how to get kids involved in writing software.

I think theres two main motivations for kids to program, wanting to write web pages, and wanting to write games, (and perhaps also wanting to solve math homework problems)

Well there seems to be a couple of questions here:
- whether a programming environment comes with all computers. I think the answer is a yes but it is not as prominent as it were in the 80's.
- whether there is a lingua franca language - my personal vote is Java/C#.
- what language is good for beginners and kids. I'll go with logo because I have experience teaching kids and i know it works. For adult beginners I recommend Java or C#/VB.Net because it encourages good programming practices (and jobs).

That leaves me to one of my pet peeves - copy and paste programming - which anecdotally is prevalent in the bunch of programmers brought up after Windows is popular. The environment makes copy and paste too easy that most don't think much before doing it because "it just works". *sigh*

Mark W

Dan:

Thanks! That's absolutely fantastic; I had no idea it was available online! I've pushed so many people to read it, I feel kind of guilty about the fact that it normally costs something like $60. I'll definitely be sending that link to lots of people.

That's going into the links sidebar on the front page, too.

Mark, I think that SICP might be a bit much to throw someone at right away, unless the particular person has a large amount of theoretical math background, which is not something I'd assume of the general population. I'd recommend more something like How to Think Like a Computer Scientist.

Personally, I think that an approach to teaching a subject that says "here's how an expert understands it; how can we lead neophytes directly to this type of understanding?" is misguided. I think that SICP attempts this type of approach.

When acquiring a skill, you can't begin with a solid theoretical foundation. This is one of the things about my calculus students that would always frustrate me so much as a TA: leading them to derivations was like pulling teeth; they seemed to have this perverse desire to want to be spoon-fed and only told how to solve the problem. Occasionally, I do remember students wanting to see a derivation after being handed the technique, but I always considered this an abberation. I always figured that once knowing "the answer", the motivation to see the derivation would be all but gone. This, though, was backwards.

Then came the time I was trying to get my greasemonkey (as in car-engine fanatic) friend to explain to me over the phone how to do something to my parents' old VW golf. You can imagine the conversation, my frustration at just wanting to know how to do it, and the subsequent enlightenment about how human beings learn.

This may be the advantage BASIC offered against modern programming languages - with BASIC, you could just get to the "do it" stage faster. You could also be handed how to do it by a listing in a magazine. Yes, this means we learned programming without learning the proper theory first, but that's the way humans learn things. The pipe dream of having a large population of students that learn programming "the right way" and don't have to unlearn "bad habits" is just that - there may be some people who can learn programming from the theory first, but I'm willing to bet that these are very rare learners indeed.

Now, don't get me wrong, SICP and the Little Schemer are wonderful things to read after one has done some programming and feels comfortable about programming as an intellectual activity. I just think that recommending it as a starter is poor pedagogy. (And I'm aware that MIT uses it as their first course; I think that MIT has a culture of throwing students at ineffective ways to learn and then congratulating the survivors on making it through)

For Jane:

There is also video of a class taught by the authors of SICP available on the Web. It's based on the 1st edition of the text and looks a little dated, but is still highly recommended.

Also, there are web sites that provide online interpreter text windows for certain languages, so anyone can start programming just by pointing their browsers to the sites--no need to install anything on your computer and it's completely platform-independent. Here's one for Ruby. (I'm thinking there is something like this for Scheme too, but I don't know of a link off-hand.)

So... I saw Brin's column too. I don't know exactly how to respond to it, because I agree with the column's spirit while disagreeing vehemently with the column itself.

Basically: I think there is a real lack in the programming world right now for what BASIC represented. However, the programming world is much, much much better off now that BASIC itself is gone.

BASIC is simply not a good introductory language. The things you learn while writing BASIC are not homologous to anything in any language in use today. Even in BASICs with ad hoc support for procedures, you are rarely learning what you really need to move forward into another programming language. BASIC generally prepares you for nothing but more BASIC, and assembly. The old joke about BASIC "ruining" programmers is not a joke. I know that I grew up in an era where BASIC was common, and once I got to junior high or so (many years ago) my transition to real programming languages was slowed because of overexposure to BASIC before that point. As we move forward into an era where languages are getting more and more high level, BASIC will become more and more distant from the things you actually need to learn to have a basic grasp of programming.

However, I do think we need a "basic" programming language which very young or very introductory programmers can be introduced to, that will allow them to get started right away. There is a gap where this ought to be right now. There are a number of "simple" or easy or use or learn languages popularly available right now, but none which are specifically intended to be readily grasped by a complete programming outsider (either in their design or in the kinds of introductory literature we find common), and none which are forgiving enough it really feels like training wheels. I think we'd be well served if such a language existed. Hopefully this language would be similar enough in structure to a "modern" language like java or something that someone could move on to a "real" language afterward without total culture shock, while simplified enough in rules and syntax as not to overwhelm a 6 year old.

Basically, someone needs to look into developing some language N where N is to python what LOGO was to LISP.

(Someone suggested Squeak/Smalltalk earlier in the thread; I've not used it but from what I know about it that's possibly a great idea. I'd suggest it might be wiser to make the gateway drug language have a more "traditional", by which I mean C-like, syntax than smalltalk, but hey, y'know, they can always just go on to learn Ruby next...)

By Andrew McClure (not verified) on 20 Sep 2006 #permalink

What I miss about BASIC on my Apple ][ was the accessibility of the graphics. One command (HGR) put you in graphics mode (with a text window at the bottom), and HPLOT X,Y would plot a point. I spent lots of time making pointless screensaver-type images with random numbers and trigonometric functions just to see what would happen.

In the languages I use nowadays, you can't just sit down and start plotting points -- you have to know a little about windowing and event handling, maybe choose between different libraries, and get a lot of syntax and incantations exactly right before you finally see that first point of light appear on the screen. What's the shortest java program you can write that plots a white dot on a black background? How about python?

Of course I understand what that extra complexity buys us, but I think it points to a need for simpler languages for beginners looking to enjoy their first baby steps without a lot of necessary background knowledge.

Oh, one more thing -- while I'm not a big fan of BASIC now, I think it's just fine for beginners. A beginner, especially a kid, needs to get used to the idea of variables holding values, instructions executing in sequence, what if-then means, the difference between PRINT and INPUT, etc. It's that seemingly obvious stuff where you're building a mental model what imperative programming is. If anything, writing then debugging some spaghetti code with GOTO's and GOSUB's should help you later appreciate WHILE and named functions! Anyway, it worked that way for me.

I occasionally feel nostalgic for BASIC. For a long time, the first thing I'd do on a newly encountered brand of computer, was run the following 3-line beastie:

1 t=t+1
2 poke t,t
3 goto 1

It's amazing how varied a reaction one gets to a diagonal poke across the memory space on different computers. When I tried that via MS Basic on my dad's Mac SE for the first time, I thought I'd broken the computer -- screen went wacky and the speakers made the most horrendous noises. Ahh, yes, the memories of BASIC.

Right, back to the discussion at hand. But if any of you guys DO have a basic interpreter, I still wonder what that would do to Windows....

By G Barnett (not verified) on 20 Sep 2006 #permalink

If executed naively on a modern copy of Windows, the code you describe would just pop up the "this program has committed an illegal operation and will be shut down" dialog box and close the BASIC interpreter.

By Andrew McClure (not verified) on 20 Sep 2006 #permalink

BeanShell is a very cool interactive "scripting" frontend for Java. It can do everything the old BASIC could (like giving you a line oriented environment to play in) as well as nearly everything you can do in Java (and a few things you cannot do in Java). It's also on its way to becomming part of the "official" Java from Sun.

http://www.beanshell.org/intro.html

But about the learning to program issue:

My first question is why do you want to learn? If you just want to glean some idea of what programming is about, many of the above suggestions are good ones. Beyond that I think there are two main reasons.

(1) You need to get something done for which the solution is not available off the shelf. These days that's often in the area of XML and its related technology. XSLT is both interesting and useful. JavaScript, Perl, PHP, etc. are useful but I can't bring myself to call them interesting (we all have our bet peeves). But what matters is having an ability with some appropriate language to get the job done. The tools are everywhere and free.

Let's face it, though, if you are doing a one-person project -- and you are new to programming -- unless you are one of the super nerds you are not going to be creating 1000's of lines of code. Which brings me to

(2) You really want to understand software engineering and the ins and outs of building serious, maintainable, well-structured programs or more likely sets of interacting programs. The sorts of things that many people work on in teams. That's a much different problem space. You end up knowing about several languages (at least) and, if successful, you'll have a huge appreciation for software quality assurance and the experts in that field. (And a lot about people management.)

What's annoying in (2) is that most serious software projects fail (or get cancelled) and there is -- still! -- a dearth of skillful people who know how to start, staff, budget, and run successful projects.

Sorry, been in the trenches too long.

Just one more thought:

BASIC, Perl, JavaScript, etc. are useful. SmallTalk is clever. Scheme and Lisp are elegant. As MarkCC, our champion nerd host, has noted there are an incredible number of programming languages. Most of them don't get used for much. If you are building anything of real complexity these days (and getting paid for it) it's likely going to be a Java project (C# is just Java from and for MS) or Java with some C and/or C++.

When it comes to writing commercial software, you are very fortunate if you ever have the pleasure of contributing large amounts of code, let alone big chunks of design, to a new product. The opportunities are few and far between -- and as I noted before the sad fact is most projects don't see the light of day. Don't get me wrong, I find it tremendously rewarding -- but then I've been one of the lucky ones. Most programmers do maintenance, extensions, and QA which is one reason there is a lot of hype around being a "real developer." Nothing wrong with doing maintenance, extensions, and QA; those tasks have their own rewards. It's just that many entering the field have a misconception of the competition and skills required for the coveted "senior developer" and "architect" roles to say nothing of the business environment that surrounds a software project.

You know, now that you mention it (and as I see now that Daniel Martin has already pointed out), JavaScript actually is probably the best BASIC analogue we have today. It's lawless and simple enough that a 4-year-old can program it, it can be made to "look like" C, it features higher-level features like object orientation if you want them, a large amount of sample code is readily available, graphics and GUIs are located very low on the learning curve, and an interpreter exists on every computer in the world.

Maybe we just need Firefox to make the interactive Javascript interpreter feel more like a BASIC interpreter (and rig up SVG in the default install so that Javascript can be used to draw things), and we're set.

By Andrew McClure (not verified) on 20 Sep 2006 #permalink

Umm... We live in a wider and more fragmented world, with different skills needed, and most basic software utilities for free. All for the best, I'm sure.

Maybe I've been a lucky one too. When I changed from hardware to software developing it was in a biotech firm with little previous experience. So the first generation of klutzes designed and developed in everything from Matlab for rapid prototyping to Labview/Windows for support applications to C/Newt/Linux for instruments and testing. Maintenance, extensions and QA goes without saying. The latest generation seem to assume you install and run free linux and IM at home and do CSS/HTML/Javascript at ease - IMing is really speeding up problem solving and learning, and customer interaction with web support is great for all involved. So I both do and don't recognise AndyS experiences. Did I mention diversity is fun?!

By Torbjörn Larsson (not verified) on 21 Sep 2006 #permalink

When I read Brin's claim that Basic was good because it was "line oriented" I drew a different conclusion. Rather than assuming he was appreciating it's interactivity, I assumed that he was appreciating the fact that with line numbers and goto statements it gives one an instinctive feel for a Von Neumann machine, or Turing machine.

But I agree with Mark that this is utter hogwash. I don't think that there's anything particularly GOOD about learning the idea of goto rather than learning gosub (aka subroutines). In fact, I'd strongly prefer the latter. So I think Python, or Javascript, or even Scheme -- some modern language would be a better choice for teaching his son how to program.

And the old textbooks with programs in Basic should be reprinted with new editions.

By Michael Chermside (not verified) on 21 Sep 2006 #permalink

I think plain HTML can have many of the same properties mentioned about Basic. You can take some web page you like. Copy its source, tweak it here and there. Further, knowing HTML can be vastly more helpful than knowing BASIC...

Michael Chermside wrote:

So I think Python, or Javascript, or even Scheme -- some modern language would be a better choice for teaching his son how to program.

And the old textbooks with programs in Basic should be reprinted with new editions.

David Brin wrote:

Many readers are so enthusiastic for PYTHON... and I admit it seems to be the logical successor to BASIC. It allows simple syntax and direct expression of the algorith in sequential lines of code -- which would be highly compatible with the notion of collaborating with schools and textbook publishers. Indeed, as Blake points out [in an earlier comment], an effort along these lines can be seen at: http://www.python.org/doc/essays/cp4e/

Indeed, Python is so widely available, that the goal might be achieved simply via some kind of DECLARATION... say by a prominent education association... declaring support for a Python-based universal entry-level environment. If well-publicized, that may be all that's needed for everyone from Microsoft and Apple to textbook publishers to lift their pinkies (a minimal twitch) and make this happen.

I don't follow how HTML is remotely related to programming languages. All I can see in it is a lesson in hierarchical structures and even there it lets you break the rules pretty much arbitrarily and learn nothing about even that.

I second BMurray on this point. Hrrmf? Document markup ain't programming.

The ScienceBlogs spam filter ate this the last time I tried to post it, so I shall put the source address down in the URL field for this comment. First, recall what Michael Chermside just said:

So I think Python, or Javascript, or even Scheme -- some modern language would be a better choice for teaching his son how to program.

And the old textbooks with programs in Basic should be reprinted with new editions.

Now, in the blog post I cite below, David Brin sez:

Many readers are so enthusiastic for PYTHON... and I admit it seems to be the logical successor to BASIC. It allows simple syntax and direct expression [...] Indeed, Python is so widely available, that the goal might be achieved simply via some kind of DECLARATION... say by a prominent education association... declaring support for a Python-based universal entry-level environment. If well-publicized, that may be all that's needed for everyone from Microsoft and Apple to textbook publishers to lift their pinkies (a minimal twitch) and make this happen.

Two posts earlier, he says of BASIC, "I rather dislike the ugly old thing!" -- meaning, I think, that Andrew McClure's distinction several comments above is spot-on.

But enough of this. Let's talk about something less controversial, something not so guaranteed to boil the blood. Gay marriage, for example. Abortion. The Iraq war. Anything!

I can remember the "good old days" of BASIC programming on ZX80s, BBC micros and the like. By contrast life for the programming beginner is far easier today than it was back then. There are numerous free programming languages (for C++ on Windows I use Dev-C++), it's much easier to get help when you need it from the vast quantity of information on the web (all I had when I was a kid was a lousy user guide and a few other books which I had to shell out pocket money for). Also the types are programs which a beginner can hope to write these days is mind-boggling compared to the very limited applications which were possible 25 years ago. Computers can simply do more things now than they could then.

By Bob Mottram (not verified) on 21 Sep 2006 #permalink

I've never seen it fail yet: every time I hear somebody moan "There's a lack of programming tools! How will the next generation learn to program?" I ask, "What platform are you running?" "Windows!"

Gee, golly, wow, Microsoft doesn't pack it's system with free tools to create your own system from end to end? Color me surprised! Tell people to crawl out of that little box Redmond puts you in and they'll see new horizons. Even the paid-for tools, excuse me, are miserable by comparison. When all I knew was Windows, I was struggling with C++ and seriously doubting that I'd ever truly like programming. Got a Linux box and discovered that once I had some real tools to work with, I had gifts for programming that I'd never imagined.

My wife and kids both play with Python on the command line, having picked it up from watching over my shoulder; the cool thing is that they're not even geeks - to them it's just another thing they can make the computer do.

To throw my own little story out here...

I first started programming in the 9th grade on my TI-83+ calculator. The night that I got it I stayed up till 2am with the manual until I wrote my very first program. I called the language "Calculator BASIC", but I don't know what it was really. By the end of high-school I was so good at the thing that I programmed mostly without looking at the screen at all - I just *knew* where each menu was and what number all my commands were, so I just had to watch what button I was pressing.

My best program there was a little math helper I wrote myself in geometry, to calculate stuff that was drudgery for me. Over time it expanded to calculate all sorts of things from algebra and even calculus. I eventually transferred it to a few people, and was very surprised a year later when I saw people using Mathmenu that I had just met! I was already learning C++ and Java by then, but I still loved programming things on that old calculator.

I even found a way to finagle subroutines into the thing (all it had was a goto), by using a lookup table for all the labels, and a stack holding label values implemented with a list. That was rather interesting. ^_^

By Xanthir, FCD (not verified) on 21 Sep 2006 #permalink

Keith mentioned the "Kids Programming Language" briefly above. But, it is worth saying more since KPL is far and away the best choice for the spiritual successor to BASIC.

Kids Programming Language
http://www.k-p-l.org/index.php

Here's why it is a worthy BASIC successor:

1. It is free and comes with a modern IDE
2. It is a simple, object-oriented language
3. You can write "hello, world" in six lines of code
4. You can write games using the mouse, sound, and graphics
5. Later you can convert your "toy" projects to real Visual Basic or C# code, automatically.

The biggest hurdle for kids these days is that while their fathers could write state-of-the-art video games (PONG, PACMAN) in BASIC, they have to climb a much steeper hill to recreate anything close to their favorite games.

KPL offers enough built-in graphics (2D sprites now, 3D engine is in beta) that kids have a shot at making something their friends won't laugh at.

Flash could've been the new BASIC except that it isn't even close to free ($500+) and few kids dig underneath its timeline/flipbook animation capabilities to use its excellent programming capabilities (ActionScript). Imagine if Macromedia offered a cheap "ActionScript Game Kit" product. Every code-curious kid on the planet would flock to that platform.

Do I understand correctly though that KPL is windows-only?

By Andrew McClure (not verified) on 21 Sep 2006 #permalink

Sjones:

I still prefer Squeak. It's got all of the properties you mentioned about KPL:

* built in graphics (both 2 and 3d), easy to use scripting of graphical objects to respond to mouse actions, keyboard actions, collisions, etc.

* beginner programming is done by direct manipulation. You don't write a statement to put something on the screen; you just drag it onto the screen, and then when you want it to do something, you attach the script to tell it what to do.

* "Hello world" is a one-liner ( "Hello world" print ).

* The programming environment supports various levels of sophistication from the ultra-simple graphical scripting to full-blown smalltalk.

* It works on every major platform that I've seen - Windows, MacOS, Linux. I've even seen Squeak running on an iPAQ handheld!

* There are reams and reams of code of all levels available to look at and learn from.

* It's part of the best programming environment ever built - for beginners or sophisticated users.

G Barnett,
by any chance is your first name Gary?

I would like to restate what another poster (above) has said. Namely, Windows (the most common OS) DOES come with basic in the form of VBScript. Merely typing the commands in a text file and naming it *.vbs results in a runnable script.

In addition, the office suite (often preinstalled) uses Visual Basic for Applications (VBA).

You are quite correct in pointing out that BASIC dialects are very different. VB, VBS, and VBA are all quite different, despite all being MS Visual Basic dialects. They all can inteface with the common OS libraries without much effort, if any. There will be some functions which may require a hack because of data types (lack/limitation).

I found BASIC to be extremenly accessable. I taught myself basic with just a list of keywords. I was introduced to it on the TRS-80, but didn't really get into it until I had an Atari 800. We also had a cp/m machine and IBM PC variants. Later when I got a hold of QBasic, I wrote a vector-graphics asteroids clone. Had save games, flashing text, recordable demos. No sound though. Functions are good, line numbers suck.

I still use VB for day-to-day tools as I need them. Mostly database access, batch renaming graphic files, minimal user interface stuff.

I disagree STRONGLY that BASIC does not prepare one for other languages. The underpinnings of all programming are there in the language and once the concepts are learned, it becomes much easier to pick up other languages.

What I learned from BASIC, and introductory Turbo Pascal in the early 80's has enabled me to pick up other languages as needed. Various macro scripting tools for applications over the years, javascript, PHP, etc. Note that programming is nowhere to be found in my job description. Its a handy tool.

I read the brief discussion of KPL with some interest but have to say that six lines to produce "hello world" hardly strikes me as "simple", though I admit it does seem to be consistent with OO languages in this regard.

@BMurray:

Apparently you can actually do "Hello world" in five lines. And until you understand why OO is a good idea, four out of those five lines are nothing but black magic:

Program HelloWorld
Method Main()
PrintLine ("Hello, World!")
End Method
End Program

There are plenty of free C/C++ compilers for Windows, including compilers provided by Microsoft. So I'm not sure where you're getting that. Good points though.

There are plenty of free C/C++ compilers for Windows, including compilers provided by Microsoft. So I'm not sure where you're getting that. Good points though.

Yeah. There is a Windows port of GCC out there. I think it's incorporated into that Dev C++ thing. Oh well, too lazy to look.

Tyler:
Yes, the mingw port of gcc.

By Torbjörn Larsson (not verified) on 24 Sep 2006 #permalink

Ah yes, when I were a lad we had five different shift modes, and we could type graphics in frm the keyboard, etc, etc.

I to remember those days, and they were arse. Line oriented BASIC was a nightmare from which I was happy to awake, even QBASIC looked good by comparison, for goodness sake !

Anyhoo, the real point is that "kids these days" have plenty of incentive and tools for programming, look at all the IM and mIRC scripts that are around, custom media players, etc etc.

There are now vast communities of youngsters coding their little hearts out, and none of them are having to suffer the awful indignity of programming in a crippled language that had be stuffed into 2k of ROM.

Yay for the future !

'-)

In fact, many kids get their programming start modifying open-source code for first-person-shooters (Quake, Unreal).

Well, as a senior programmer I've seen a lot of 'freshly-baked' Java-programmers, who know how to get up and running a n-tier system, but having it 'get the shit done' fails due to lack of understanding the still mostly sequential execution of the code.

OOP is great for design, prosedures are nice for maintenance, but if you don't grasp the idea of storing/retrieving stuff in the variables they are no good at all. For that BASIC was good - some other language like Python may be as good, but...

I thought I'd let you know that David Brin replied to my blog about his article with some good clarification about "Why Johnny Can't Code". I've linked my blog entry with his response at the URL above. Seperately, from his web page: "What I didn't expect was the flurry of intensely passionate replies!" :)

I disagree that non-trivial portable programs could not be written in BASIC. In the 70's, i wrote many BASIC programs in the 100 to 1000 line size range that ran under multiple variants. If one wanted portability, there may not have been a guide, but there was more than a Turing Complete subset.

My Palm didn't come with a language. I downloaded the free cbasic. This variant of BASIC is one of those brain dead versions. Arrays may only be single dimensioned, and other problems. I've written a half dozen programs. One feature is that these programs run on other, less ham strung variants. There is a Linux port of cbasic, that is entirely compatible with the Palm version.

I have a Psion Organizer II. It comes with a BASIC-like language called OPL. Not having touched it for years, i can still pick it up and write new stuff for it without a manual. This is not true for Forth, the Forth-like HP-28 language, Lisp, Perl, C++, Java, apl, and many other languages. It's true for some C, some Fortran, and only a few other languages. The barrier to entry for BASIC is remarkably low. That, not it's portability issues, is what made it great. It's not for everyone, or for every task. But a simple language is not only easy to learn, it can make it easy to maintain programs written in it.

There is alot to be said for having a simple language bundled with a distribution. (Yes, i use Linux alot). It was distressing in the 80's that for $1500 you'd get Unix for your PC, without a C compiler. Useless. You can't do everything in the shell.

In 1987 i bought a Mac II and a PC/xt. I used the xt primarily for about a year. The Mac was much nicer, and sat on the same desk. It wasn't until i picked up a C compiler for the Mac that i really started using it. Then i picked up MS Word and a laser printer. I think was stupid for Apple to drop bundling a simple language and simple word processor with the Mac. They could have dominated the desktop. When Turbo C came out for the PC, i started using DOS again.

Most of the "porting" I did among different BASIC dialects didn't involve copying files from one computer to another. How do you copy a file from a cassette tape recorded by the Atari to the 20 Mb hard drive of the 286 PC? You don't. Instead, you look the program up in the Atari manual or your source-code printouts and retype it. In this situation, a certain amount of modification comes naturally.

The barriers between any two BASIC dialects were always smaller, in my estimation, than the barrier between any of them and C. (Guh!) Even a lingua franca can have regional accents. . . .

From Chris: What's the shortest java program you can write that plots a white dot on a black background? How about python?

This is a Python Tkinter example:

from Tkinter import *
w = Tk()
b = Canvas(w, height=150, width=200, background="black")
b.pack()
b.create_line(30, 40, 31, 41, fill="white")
w.mainloop()

But if you automatically import a graphics module at the start of Python, you can do the same with this, in an imperative way:
http://mcsp.wartburg.edu/zelle/python/graphics.py

from graphics import *
w = GraphWin()
w.setBackground("black")
w.plot(100, 150, "white")
w.getMouse()

Adding few more lines of code inside that module you don't need the w reference anymore, etc.

Regarding Java, you can use the Processing sublanguage:
http://processing.org/

I'm only now finding this...(Jan '09) I too remember programming on a Tandy pocket computer in BASIC with 1.5k...and a CoCoII..and eventually an IBM-PC with BASICA. Eventually I got reasonably good at writing spaghetti code. Enough so that when I first saw Pascal I thought it was WAY too wordy! Now in advanced years after decades away from writing code I'm back studying Visual Basic, C++, and Java (because that's offered at the nearby college) but really my vote for a language that is readily available (even runs on my long out of date Palm hand-held) is Forth. Its odd looking at first, but if the joy of programming comes from writing instructions for a machine, I can't really think of a better choice. Powerfull enough that first time users can change the defination of the number 7 . For nostalgia I sometimes take a break and run a zx80 emulator running Forth (complete with the screen going black when refreshing) on my laptop.

By Stephen Lund (not verified) on 29 Jan 2009 #permalink