BASIC, why ? The answer might surprise you ! (part 1)

BASIC is dead !

BASIC is for beginners!

BASIC is not a professional language!

 

Do you feel this way ? Have you heard this before ? You might be surprised at why some prefer the BASIC language over others. I can’t speak for others, but I can speak for myself having done programming since the late 1980’s and the answer may surprise you.

One’s opinion has little meaning if you have never written a complete application from scratch which was actually used in the real world.

Confused ? Don’t be. No matter what computer language you use, what really matters is the end result. Can you build a complete application which runs well in real world use ? True, many work as part of a team today and may not write the complete application by themselves, but at some point in a programmers life they really need to have the experience of writing a complete application from beginning to end. Why ?

The lessons learned are invaluable!  Let’s consider some.

Time matters !

Yes, the old saying that “time is money” means that if one can’t develop a fully working application within a reasonable amount of time, the cost will be too high and the project is likely doomed to failure. Who cares how “great” your favorite programming language is or even whether it is the latest technology, if one can’t finish a project on time or even sooner. The faster one can code and code well, the better. Guess what ? That is one of the reasons BASIC programmers love their programming language. BASIC code is notorious for being easy to code quickly. The reason is that “ease of use” and a “natural syntax” have always been a primary goal of BASIC. In the old says, BASIC programmers like myself didn’t have visual designers or intellisense code editors. The easier it was to code naturally, the quicker it was to write an application. It is just that simple. BASIC programmers use BASIC because it is fast and easier to code quickly.

If a programmer is simply “on the clock” and gets paid by the hour no matter what they produce, then they have little incentive to code quickly. Many a BASIC programmer though has done contract or custom work, writing a complete application for a fixed price or a fixed budget (meaning they may get paid by the hour, but the client will only pay so much). Time matters in such a situation.

That is why I have always used BASIC. On a good day, some BASIC programmers can output 50 to 100 lines of code an hour, rather than in a day. The ease of coding in BASIC is partly because of its more natural language syntax. Unlike C where the syntax appears to have been more for the sake of the compiler rather than the programmer (be honest here, who came up with the idea of curly brackets surrounding everything?), BASIC’s syntax was designed for the programmer, even if the compiler had to work harder.

The only good code is bug free code!

If there is one thing programmers often don’t like to do, it is to debug code. Debugging is a waste of time, some may say. Leave to end users to find the bugs, they may think. BASIC though is a language designed for debugging, for writing good code. Just think about it. In the old days, compile time took forever (remember feeding punch cards into the computer and waiting forever for it to compile) so when time sharing BASIC came along, while it lacked performance, it excelled in quality. You could enter code and immediately run and test it, find your errors, fix it quickly and then run it again. The end result was more code written which worked better. BASIC was a paradise compared to the compilers of the time.

Over the years, one of the biggest criticisms of BASIC was that it was an interpreter and oh so slow. The interpreter made BASIC better back then when computers were slow. It produced better code faster. Amazingly I still hear this criticism of BASIC today and it shows how little most programmers understand what BASIC is all about. Strangely some of the most popular languages today are scripting languages, so the argument tends to fall short now. But BASIC took a different route over time and while it kept its fast development, it also caught up in performance in one of two ways.

Some BASIC’s (ie. Quick Basic, Visual Basic) took the route of combining the feel of an interpreter using PCode compilers (compile on the fly) for development, but adding a secondary full compile stage where one could compile a finished program to full blown machine language (now you have performance too). Other BASIC’s took the path of compiler only, but the compilers were optimized for high speed so compile time was so fast one did not need a pcode interpreter. BASIC’s such as Borlands Turbo Basic and today it’s great grand child Powerbasic took that route. And believe me when I say such compilers can compile lightning fast. For example on a typical Walmart style mass market computer (not your typical core I7 high end programmers PC) the Powerbasic compiler can compile 50,000 lines of code per second. The Powerbasic compiler was written in assembler so it compiles at amazing speeds.

Reliable code is BASIC’s advantage

This may surprise some too, but it is true. BASIC’s natural coding style makes code more readable. The more readable code is, the easier it is to find errors and to understand what the code does even years later.  Having been a WIN32 programmer for a good 2 decades, I can vouch for how much easier it is to read WIN32 code written in BASIC than it is in C.

Especially with Windows, being able to follow code flow is critical for writing good code and debugging code. If you can’t read the code quickly then trying to find errors will be a nightmare, simply put. A don’t think one can pawn off the debugging to others. The best programmers are likely ones who debug their own code and who work hard to write good code from the start.

I should point out that BASIC is no longer like its early versions with things like line numbers and lack of modular syntaxes. Early BASIC interpreters were actually state of the art for the time. They solved the problem with slow computers by using every trick in the book to get performance out of being an interpreter. They used PCode (or tokens) for faster speed. Syntax was for the sake of faster execution (ie. line numbers) internally. But once computers caught up and had decent speeds, BASIC no longer had to be limited and so it quickly shed much of its past limited syntax (ie. line numbers) and began to borrow as many useful features as possible from other languages (like Pascal) while maintaining the goal of ease of use and natural syntax. In time BASIC , while keeping ease of use, added many low level features normally found in languages like C, such as things like inline assembler, pointers, etc. Simply put, there is not much than a modern BASIC can’t do.

Summary

So far we have discussed the following reasons BASIC is a value language. First, BASIC coding is fast because of its natural syntax and design for ease of use. Second, readability helps produce better code and makes debugging easier. Its ease of use also tends to produce better code up front with less need to debug afterwards. Third, BASIC is modern and has many of the core features a modern language requires. Last, BASIC can perform.

 

There are many other reasons BASIC programmers prefer this powerful language. If you are a BASIC programmer, what are the reasons you prefer to use it ?