The Myth about BASIC (part 2)
BASIC is one of the most misunderstood programming languages!
Mention BASIC to a current software developer and one quickly finds out that it is not viewed favorably by most programmers. “Obsolete”, “for beginners only”, “unstructured”, the descriptions go on. This common view discourages the development of a new generation of BASIC programming languages. Also misunderstanding “why” BASIC is so loved by many, those who have tried to reinvent BASIC have only made its demise come more quickly. “Basic is not a viable professional language” may probably be its most damaging criticism.
Who better knows what BASIC is about than a long time BASIC programmer.
How long have you personally been programming in a specific language ? 5 years, 10 years, 15 years ? This developer has been using BASIC for over 30 years and my first exposure to BASIC was back in 1975, which is over 40 years ago. So rather than ask your fellow developers, who specialize in C or Java, what BASIC is about, it makes more sense to ask those who have years of experience using BASIC, “why do you use it” and “what are its benefits”.
Microsoft got it right and then they got it somewhat right and then they got it wrong.
To better appreciate Microsofts first real success with BASIC, one has to better appreciate the era when this occurred. Back in the 1980’s the home computer revolution occurred. Remember the Commodore 64, the TI-99/4A, the Atari 400,800, 600XL, 800XL and so on ? These so called “home computers” were actually not a consumer device. They were too expensive for that. The Commodore 64 was $595 back in 1982 which would be close to $1500 in today’s currency. Definitely not a typical consumer device. So who used such “home computers” ? People who had a leaning towards technology. It was an expensive hobby, but many grasped at whatever home computer they could afford. I didn’t get my Commodore 64, TI99/4A and Atari’s until the market was slipping a good bit and I was able to pick them up on clearance for only $50 each at a local Rose’s store.
I accidently slipped into programming (it is a long story), but suffice it to say that my first commercial programming work was done using interpreted BASIC on CPM computers. CPM was before IBM DOS based PC’s. I did a lot of programming on the Kaypro CPM computers. Now read up about Kaypro computers and see what us old timers called portable computers. If I remember correctly they weighed a good 20 to 30 pounds. But despite such limited hardware (64 KB ram, very slow CPU’s, disk drives with 360 KB space), BASIC programmers were able to write amazingly powerful business software. My first real custom programming job was for a local manufacturing company and its quality control department, where I wrote software which downloaded test data from testing machines and then ran it through statistical analysis software which printed out bar charts.
BASIC was designed not for beginners back then, but for computers with limited computing power. BASIC being interpreted, allowed one to write and test software almost instantaneously. That could not be done using compilers. Compilers took way too long to just compile an app. In the main-frame days it took hours to compile an app. In the CPM desktop PC days it at least required a nice long coffee break while waiting for the app to compile. BASIC was actually one of the most productive languages of the time and a lot of software was written using it.
Then came the IBM PC! Next came the PC “clones”! Microsoft had a “hit” with Microsoft DOS on the clones and soon MS-DOS became the standard for a business PC. CPM died out after that. Then came DOS 2.0, 3.0, 4.0 and so on. BASIC moved on to the PC in the form of QBasic an interpreted language. QBasic became the defacto standard for BASIC programmers and the raw power of DOS PC’s was now powerful enough to handle a decent compiler and Microsoft introduced QuickBasic (Borland International had their compiler called Turbo-Basic, but more on that later). QuickBasic 4.5 is the version that really became the defacto standard for BASIC programmers and it was affordable.
A lot of commercial software was written using QuickBasic. There was even a Professional version later released called PDS (or Microsoft Professional Development System). I used both QuickBasic 4.5 and PDS 7.1 back then. I wrote a number of custom applications for businesses using PDS 7.1, from machine shop job tracking, auto repair shop software, to accounting software. Computers back then, again were not consumer products. Often a decent PC cost from $2000 to $5000. I got my first PC (Blue Chip clone) used and I sold most of my “home” computers (Commodore, Atari, etc.) just to be able to afford a used PC.
Yes, Microsoft got it right with QuickBasic and PDS 7.1 !
So how did Microsoft get it partly right and then wrong later on ?
First, what was right about QuickBasic and PDS 7.1 ? They were both a PCode compiler (which allowed fast internal compiling to PCode which simulated acting like an interpreter) and a true compiler. Development was lightning fast because, despite the still slow hardware, one could test software quickly (pcode) and then, when working, compile it for even faster execution speed. Microsoft BASIC allowed you to write modules in other languages as well. I wrote some modules in assembler for ultimate performance. Microsoft BASIC, while still supporting some old style syntax from the QBasic days (for backward compatibility), had improved the language with many modern features similar to Pascal. We had true functions, procedures (Subroutines), many new logic commands, excellent data type support, database support and much more.
BASIC was truly a professional programming language !
BASIC supported modern language syntaxes (no line numbers needed anymore) and was modular in design.
Myth #1 debunked – BASIC eventually became a professional language, not simply remaining a beginners language.
The next generation of BASIC was much different, simply because a new operating system became the standard. First we had Microsoft Windows on top of DOS (ie. Windows 3.1) and then Windows itself became the operating system (Windows 95). This change to a Graphic User Interface based operating system turned the BASIC world upside down. Microsoft would next get BASIC partly right for this next generation and partly wrong. The story continues and gets very interesting. The next generation became Microsoft Visual Basic.
What was right about Visual Basic?
Visual Basic did many things right. GUI software simply could not just be coded, but really needed a visual environment. Actually, GUI software can be just coded, but it would require either an excellent GUI framework designed just for hand coding or long hours coding to the WIN32 API directly. Since GUI’s tend to be more complex, a visual design environment really did make a lot of sense at the time. Visual Basic once again put BASIC on the map and it too became one of the most popular languages of the time. Visual Basic’s success likely even surprised Microsoft. Why ? Because, in hindsight, it appears Microsoft was not trying to leverage Visual Basic as a professional programming language. How Visual Basic came to be and how it changed over the years attests to this.
What was wrong with Visual Basic ?
Unlike QuickBasic and PDS 7.1, it appears that Microsoft was not up to the challenge of creating their own professional BASIC for Windows. Yes, it was not until years after classic Visual Basic ended that even this long time BASIC programmer learned of how classic Visual Basic came into being. I always though Microsoft developed it from scratch. But it appears they did not. This following story of the true “father of Visual Basic” (Alan Cooper) tells the real story:
Not only did Microsoft not originally create classic Visual Basic, but how it was really created explains why the same mindset behind professional BASIC of the 1980’s, did not continue with BASIC of the 1990’s. So Microsoft got it partly right and partly wrong because of this. Visual Basic was a success, but not for the same reasons as QuickBasic (or PDS). The visual environment of classic visual basic and its ability to use external modules (first VBX and later OCX) for custom controls and other third party engines made it one of the fastest and easiest programming languages around. Likely targeting the hobby programmer, rather than the professional programmer, classic Visual Basic would unexpectedly exceed it creators expectations, likely even Microsoft’s as well. But now a problem ensued. In the Windows early years, “real” software was suppose to written in C (not C++), while hobby software was to be written using classic Visual Basic. But classic Visual Basic programmers turn the tables and turned VB into a tool for professionals. Yes, a huge amount of commercial software started to come out from the VB world, rather than just the C world. Once again BASIC showed it was a loved language and it was powerful in the right hands.
But there was something inherently wrong with classic Visual Basic. It was not originally designed for the purpose many used it for and this became apparent as many VB’ers demanded more and more features and in particular true machine code compilation. Visual Basic was held back because it was not a true compiler, but simply a PCode compiler. Visual Basic programmers yearned for the performance speed that they enjoyed in the DOS days. Also because Visual Basic was different than both its old DOS grand parent and its rival C, it lacked much of the raw power a professional language required. Many of the low level features of the WIN32 API, which Windows depends upon, were not as easily accessible as it was in C. One simple example, one could not write low level ActiveX or OCX controls in VB itself. Most of the extensions to Visual Basic were most likely written in C, not VB itself. One could not even write a true standard DLL in Visual Basic. It would not be until VB 5.0 and 6.0 that a true compiler backend would be added and even that, from what I have read about it, appears to have been a C compiler backend rather than VB becoming a real compiler itself.
BASIC eventually would have to struggle to maintain its status as a professional language. The C world likely looked down on the VB world. Old myths about BASIC would be used as an excuse to treat BASIC as only a beginners language, rather than an equal in the programming world.
The real problem in Windows programming behind the scenes!
The real problem behind all of this is not apparent to most programmers today. Why not ? Because few have learned the real reasons for the change in programming which turned not only BASIC, but the entire programming world upside down. This problem caused both the success in classic Visual Basic and the partial fall of C (on Windows). Sound strange ? Note, I said C, not C++ and also not dot.net’s C#. The fall of C ? Yes.
Simply put, WIN32 programming was never easy. Actually it was downright difficult and still is. The transition from DOS to Windows temporarily pushed BASIC programmers back. They could not make the transition to Windows. Even though early Windows programming was still procedural in nature, the WIN32 API was just too big a hurdle for many BASIC programmers to tackle. First and foremost, because there was no counterpart BASIC compiler, like C. Windows programs had to be written in C. You just could not do it in BASIC yet. Now while the soon to come classic Visual Basic allowed the transition for many BASIC programmers to Windows, many were still left behind because Visual Basic had two key differences from DOS Basic. It was no longer primarily procedurally based (it was event based) and BASIC programmers were used to hand coding their user interfaces and a visual environment was strange to them. In time many though got use to this and successfully made the transition, but it meant leaving behind most of their code base because one could not simply port a DOS app to Visual Basic.
In the C world, they too were going through a difficult transition. The WIN32 API was extremely terse and extensive and it was not easy to code a Windows app. C programmers struggled with this and eventually turned to the new upstart in the programming world, Object Oriented Programming. Yes, GUI frameworks like Microsofts MFC (Microsoft Foundation Classes) and Borlands OWL took hold. Modular design took hold and WIN32 programming leaned on object oriented class libraries. C++ would later take hold, since it catered to the OOP syntax. In a short time, the programming world would go through dramatic changes. Visual design became the panacea of programming (aka. classic Visual Basic) and object oriented programming (aka. C++, class based GUI frameworks) took over the C world. While I would argue that visual design was a necessary next step, in many ways classic Visual Basic was superior than its C++ counterparts, the transition to OOP may have forced drastic changes which would be the demise of BASIC as we know it. While some OOP in BASIC is fine, BASIC in its procedural form is where it really shines. BASIC is all about simplicity in code. Natural language syntax is what makes it a favorite among many programmers. A little OOP here and there is fine, but BASIC shines when its code is simplest and that is in a more procedural style or at least a minimalist form of OOP. Classic Visual Basic did most of the GUI stuff via simple objects, while most event based code was written in a procedural style. At least many VB’ers who dated back to the DOS BASIC days coded this way.
What Microsoft failed to realize was that BASIC could have made the transition to Windows in a similar form as C did. BASIC could have been used just as easily as C for a primary programming language for the WIN32 and it might have prevented the need to depend so much on OOP.
Where BASIC begins to fall
Microsofts implementation of the dot.net version Visual Basic has struggled because it has lost the real purpose behind BASIC, simplicity. It appears a number of dot.net Visual Basic programmers have slid over to C#, seeing little benefit in a BASIC dot.net programming language. Visual Basic dot.net is a second class citizen in the programming world. It has lost the things classic Visual Basic programmers loved most in favor of the dot.net syntax. This is neither good or bad, since some like it, but simply the reason many BASIC programmers have either moved on to other non-BASIC languages (like C#) or simply have stuck with classic Visual Basic, despite its obsolescence. BASIC programmers need to have choices which fit into their mindset, rather than be forced into a language which for some is totally foreign.
Another BASIC parallels classic Visual Basic and makes the opposite mistakes
Remember Borland Internationals famous Turbo Basic in the old DOS BASIC days ? While not achieving the same success as Microsoft’s QuickBasic, it did give it a “run for it’s money”. Turbo Basic was superior in a number of ways to QuickBasic, but sadly Borland gave up on all its programming languages and sold them off. Most ended up in the hands of Embarcadero and they are professional programming languages today, albeit quite expensive. But what happened to Turbo Basic ? Borland did not create Turbo Basic, but Bob Zale did. Borland sold the rights to Turbo Basic back to Bob Zale and he renamed it Powerbasic. Sadly, Powerbasic was a small company and it lacked the resources of the likes of Borland or Microsoft. Yet, despite all of that he continued to develop his programming language.
Powerbasic took a different tack than QuickBasic. Rather than have a Pcode engine to act as an interpreter, Powerbasic, in both its DOS and later Windows versions, was written in pure assembler and it would compile code so fast that an interpreter or pcode was never needed. If a compiler is fast enough, pcode should never be needed. Powerbasic also took the path of “smaller, faster” rather than adding extensive libraries to accomplish things (aka. Visual Basic’s OOP based GUI extensions). Powerbasic followed the path of C (not C++). Powerbasic rivaled any C compiler of the time, both in the DOS days and in the Windows era. Powerbasic for Windows could be used to write DLL’s (Dynamic Link Libraries) for use by any other language, whether C or classic Visual Basic. The early version of Powerbasic for Windows was marketed as the “Powerbasic DLL compiler” and it targeted the classic Visual Basic market as an addon to Visual Basic for writing true DLL’s, but in BASIC. Sadly Powerbasic depended too much on marketing itself as an addon to Visual Basic, instead of a stand alone compiler. It actually could be used to write an application, but it suffered from the same problem as early C, one had to write WIN32 code (which was not easy) and it had no visual front end, like classic Visual Basic.
So Powerbasic took the opposite path of classic Visual Basic. It was more akin to a C compiler and had no visual front end. For all practical purposes though it was significantly more powerful than classic Visual Basic, since like C it could do almost anything, but the lack of a visual front end prevented it from being very successful. But it did survive and has been used by many developers for commercial software.
But something changed for Powerbasic when Microsoft ended classic Visual Basic. Its market as a VB addon forced the company to rethink its path. Also a number of its own user base began to demand visual design features, like classic Visual Basic, and while initially the company was not up to the task, its user base began to develop such tools. As a long time BASIC programmer, I was one of the early developers of such a tool. But others came along as well. It was interesting to see the different paths such developers took, as well as the path Powerbasic itself eventually took. I chose the route of a GUI framework in the form of DLL’s. Figuring that Visual Basic programmers were used to delivering apps with a EXE along with DLL’s, this would not be an issue. I though went the route of a procedurally based GUI framework rather than an OOP based one. This produced an extremely tiny framework and even in its current fifth generation the entire framework can fit on an old fashioned floppy disk. Other developers chose a different route, with a couple only building a visual front end similar to classic Visual Basic, which generated WIN32 code, more akin to coding in old fashioned WIN32 based C code, before the likes of MFC or OWL. This proved to be a very effective choice, since it became one of the more popular coding styles among Powerbasic programmers. The Powerbasic company chose an even totally different route. They added a simple GUI command set to the language, but it was more of a simple wrapper for the Windows API, which they called DDT or Dynamic Dialog Tools. It could be hand coded or generated through a visual form designer which they later came out with. The executables generated this way were extremely tiny. Powerbasic came out with a more visual design environment far too late in its history and could not pick up the many classic Visual Basic programmers looking for an alternative. Also sadly the founder of Powerbasic, Bob Zale, died in 2012 and the company floundered for awhile and only currently has been purchased by another company, Drake Software out of North Carolina.
Myth #2 debunked – BASIC still has a future and better versions of BASIC can and do exist.
BASIC has a future
Yes, BASIC is not only still around but can have a positive future and I don’t mean just Visual Basic dot.net. VB dot.net fills a certain need, but other BASIC’s can also fill a different and more important need and that is the real flavor of BASIC as many of us long time BASIC programmers know it. How many programmers can easily port code from a code base which is 30 years old to something they require today ? BASIC programmers, using the right versions of BASIC can. Even old time WIN32 code in C is actually quite easy to port to the likes of Powerbasic today. I learned the WIN32, not from a book on Powerbasic, but a book for C programmers (before MFC of course) and without all the OOP stuff it was relatively easy to port to Powerbasic.
BASIC could be the basis of the next generation of web languages, IOT languages and embedded languages. Currently a number of micro controller companies still use a form of BASIC for embedded scripting languages. While I do think we need a new generation of more powerful BASIC programming languages, currently there are a number worth noting which already exist. Most were created by small companies or are even open source, but imagine what could be accomplished it the likes of Google, Apple, Microsoft and others if they put their resources into such languages.
Some current versions of BASIC worth checking out:
Powerbasic (native code WIN32 compiler) (great grandchild of Borland’s TurboBasic)
Freebasic (native code compiler which uses C as a backend)
PureBasic (native code compiler, cross platform uses assembler backend)
GLBasic (native code compiler, cross platform)
Thinbasic (scripting language)
Oxygen (32 bit and 64 compiler)
PluriBasic (compile to Powerbasic CGI, Android, PHP, Java classes)
FuzeBasic (for Raspberry PI)
MikroBasic (for micro controllers)
BCX (Basic C generator)
Liberty Basic (hobby basic, sort of Pcode I believe)
NSBasic (cross platform)
XOJO (used to be called RealBasic, cross platform)
Creative Basic (32 bit compiler for Windows)