Edsger Dijkstra was absolutely right when he said, â€œProgramming in BASIC causes brain damage.â€ Â (Lacking a source for that quote, I found an even better quote that has a source: â€œIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.â€)
When I reflect on my (not-too-distant) programming infancy, I often think about what I might have done differently, like what technologies I could have learned, which ones I should have avoided, or what algorithms I could have used in old software I had written, and so on.
But thereâ€™s one thing that really stands out more than anything else: Â starting out with BASIC was the worst thing I could have done.
Iâ€™m not sure how useful it is to talk about this now, since BASIC has pretty much gone extinct, and rightly so, but it feels good to get it off my chest anyway.
My parents and I immigrated to the U.S. in 1991, when I was 10 years old, and I had never laid eyes on a personal computer before that time. During my familyâ€™s first few months in the States, we acquired a 80286 IBM PC, which was probably donated to us by an acquaintance (since the 80386 architecture was already prevalent at that time, and 80486 was the cutting edge).
I also happened to come across a book called BASIC and the Personal Computer by Dwyer and Critchfield. Â I was instantly fascinated by the prospect of programming the computer, and the boundless possibilities that computer software could provide.
However, I made a critical error that would hinder my programming development for at least a year: Â I reached the erroneous conclusion that BASIC was the only language there was!
I had no idea that BASIC was an interpreted language, or indeed what difference there is between an interpreted and a compiled language. Â I thought that all software (including the games I played, Windows 3.0, Word Perfect, etc.) was written in BASIC! Â This unfortunately led me down an ill-fated path of self-study, which took an even stronger effort to undo.
I learned all there was to know about BASIC programming in a few months (starting with GW-BASIC, then moving to QuickBASIC), and then I started to notice certain things about the software I was trying to write.
No matter how I tried, I couldnâ€™t make my programs be as fast as other software I used. I couldnâ€™t understand why this was the case. Â Also, the graphics routines in BASIC were virtually nonexistent, so I was baffled how anyone could write games with elaborate graphics, scrolling, and responsive controls. Â I was eager to start developing games that would rival my favorite games at the time, like Prince of Persia, Crystal Caves, and Commander Keen. Â But the graphics and responsiveness of those games was orders of magnitude beyond what I could achieve with my BASIC programs.
With all this frustration on my mind, I was determined to find the reason why my programs were so limited. Â I soon found a solution, but once again it was the wrong one! Â I stumbled upon some example BASIC code that used assembly language subroutines (encoded as
DATA lines in the BASIC program), as well as
INTERRUPT routines that took advantage of the underlying DOS and BIOS services.
This led me down the path of learning Intel 286 assembly language (another few months of studying), and encoding it into my BASIC programs! Â This solved the issue of responsiveness, but there was still the issue of graphics, or lack thereof. Â Fortunately, I found a book at the local public library about VGA graphics programming. Even more fortunately, the book contained sample source code, using a language they called “C“….
And my eyes were open!
It hit me like a freight train. I was lucky that I didnâ€™t have a seizure right there at the library. Â I realized that I had been learning the wrong things all along! Â (Of course learning assembly language was sort of right, but my application of it was still misguided.)
Learning C and C++ from that point forward wasnâ€™t particularly difficult, but I still feel like it would have been a lot easier if my mind hadnâ€™t been polluted by the programming style and structure that I learned from BASIC. Â It makes me wonder how things might have been different, had I accidentally picked up a book on C++ instead of a book on BASIC during my earliest exploits with computers.
In all fairness, Iâ€™m sure I learned some rudimentary programming principles from BASIC, but Iâ€™m not sure that this redeems BASIC as a learning tool. There were just too many moments where, while learning C++, I thought, “So thatâ€™s the way it really works!” Â And Iâ€™m sure itâ€™s also my fault for trying to learn everything on my own, instead of seeking guidance from someone else who might have told me, “Youâ€™re doing it wrong.”
All of this makes me wonder what programming language would be appropriate for teaching todayâ€™s generation of young programmers. Â Based on my comically tragic experience with BASIC, my gut instinct is to advise aspiring developers to stay away from interpreted languages (such as Python), or at the very least understand that the interpreted language theyâ€™re learning is useless for developing actual software. I donâ€™t think thereâ€™s any harm in diving right into a compiled language (such as C++), and learning how it hugs the underlying hardware in a way that no interpreted language ever could.
That being said, I donâ€™t wish any of this to reflect negatively on Dwyer and Critchfieldâ€™s BASIC and the Personal Computer. Â Itâ€™s a solid book, and I still own the original copy. Â Thereâ€™s no denying that it was one of the first books that got me interested in programming, and for that Iâ€™m thankful. Â However, sometimes I regret that I didnâ€™t find Stroustrupâ€™s The C++ Programming Language at the same garage sale as where I found BASIC and the Personal Computer. Â Or, alternatively, perhaps Dwyer and Critchfield could have included the following disclaimer in large bold letters: This is not the way actual software is written! Â But perhaps itâ€™s time to let it go. I didnâ€™t turn out so bad, right?