Am I a programmer: rethinking Dykstra and BASIC

David Brin presented a number of interesting thoughts in his closing presentation at this year's Usenix ATC. In particular, he mentioned that the BASIC language is not easily available any more. Yes, you can click on a few things to install it, but each click frustrates the interest of a percentage of novice programmers.

Apparently, math texts have had sample BASIC programs in them for a couple decades. With BASIC less available, they are starting to skip this.

Could BASIC be a good thing?

I have been programming, writing instructions for computers, for over 40 years now. My first language was BASIC, typed into a Model 33 Teletype in the basement of Pop Hall at Lawrenceville in the autumn of 1968. I was headed for chemistry then, but thought I should learn computing because it was the wave of the future. From such simple observations careers are born.

When I got to Lehigh, I ran into a curmudgeon from University of Delaware named Richard Cichelli. He announced that GOTOs were bad, and that we BASIC programmers really didn't know what we were doing (my characterization, not his exact words.)

Rich was write. Not only should we not do serious programming in BASIC, but doing so actually taught some very bad habits.

Edsger Dijkstra was even more curmudgeonly than Richard. He said the BASIC programmers were poisoned for life, doomed by the resulting brain rot.

EWD was a paragon of rigor, and I took that comment seriously. I unlearned bad BASIC (and associated FORTRAN habits), learned Pascal under Richard's guidance, and think I have answered EWD's complaints to my satisfaction. I certainly don't usually have his rigor, and programming still takes me longer than it should.

But much of the quarter-million lines of code I have written over the past 40 years has been successful and useful: as an engineer, I am well-satisfied. Pascal's a MUCH better language for installing good coding habits. Even now, after 25 years of intense C programming, the

        int
        main(int argc, char *argv[]) {

comes at the end of the main program. The program is written top- down, and the code appears in the listing bottom-up.

But what of BASIC? I grew to agree with EWD about its toxic nature. I decried its lack of control structures, and need for GOTOs. My last BASIC program was written in June 1974, and was about 20 pages long. You can find it http://web.cheswick.com/ches/software/star5.bas if you wish. It was and is awful. Why should be teach this?

I helped raise two kids, and neither is a programmer. On the occasions they asked about programming, I had pedantic problems trying to figure out what language to introduce them to. Awk? Java? Shell scripts? Logo? They never got fired up, and now they are doing other things. Modern computer games don't help: "Daddy, I want to make a first person shooter game like Quake."

Back at Lawrenceville in 1969, I taught sixth grader Bink Porter some BASIC. Last I heard, he was a programmer in industry somewhere. (Where are you now, Bink? You are probably using your grownup name now.) BASIC worked for him, and for me, and many others, too.

On re-reading The Humble Programmer, I see my memory is, as always, at least a little off. EWD called FORTRAN and infantile disorder, and PL/1 a fatal disease. Certainly BASIC is FORTRAN-like. Is FORTRAN infantile because we tended to learn it first in those days, or because it was one of the first languages developed?

Okay, BASIC, too, is an infantile disorder, but a useable development path, like chubby cheeks and eating fuzz-covered lollypops, a useful part of growing up. We can use BASIC to teach novices, and ought to. Given the software bloat in the world, a few 5 or 20-line programs in basic are a fine start.

And what about these other languages. PL/1 a fatal disease? C a high- level assembler?

I came out of Lehigh with a firm commitment to Pascal-like programming and, indeed, wrote many things in Pascal for years. Strong typing and top-down design made managing the complexity somewhat easier.

PL/1 had a compiler that was three quarters of a million lines long. How could anyone use this language? How could they hope to get things right? I never bothered to learn it.

Of course, Multix is written in PL/1, and, like many innovations, turned out to be better than its successors. It was almost certainly more secure than most operating systems used today. How can this be? Where's the simplicity?

I arrived at Bell Labs and worked in the group that invented Unix. Years before, I had reacted to C with disgust. Pointer syntax was a nightmare (thanks, Andy Koenig for C Traps and Pitfalls!). Type checking was weak, and programs and the libraries were (and are) simply damned dangerous. Still, I have programmed in it, with reasonable results.

But wouldn't Modula 3 be better? Shouldn't I switch over? I think it may well be what we should have adopted instead of C++ and Java, at least for the non- scripted programming.

Doug McIlroy disdained SNOBOL4, another language I used. sno3 was preferable. I have not taken the time to check out sno3 and decide for myself, nor did I ever bother to ask Doug about it.

Speaking of reacting in disgust, I have tried to learn Perl twice, and its TECO line noise delimiters and wild zoo of control structures have repelled me twice. It seems to promote unclear programs.

It is more important that a program be readable than that it work. I've aimed for both for decades.

I've been fortunate to know pedants like Richard Cichelli, Jon Bentley, Doug McIlroy, Don Knuth, and Brian Kernighan. I never knew EWD, nor met Nicklaus Wirth, Tony Hoare, Per Brinch Hansen and other heros of my youth.

It has been good to ruminate a little on rethinking old issues. I should probably do it more often.