Why BASIC ?

Basic (the programming language) has often been viewed by professional programmers as a beginners language or simply a toy language to play with (hobby).

Is this true ?

Absolutely not!

Why should a professional use Basic as a programming language ?

First let me say, that not just any Basic will do. The reason I use Powerbasic is because it is of a professional level and what it does it does well. But the question of why use Basic in the first place is a valid question. It has to do with an aspect overlooked by some programmers and that is the following:

Clarity of code (aka. readability)

It is so easy for a programmer to write code which looks more like a puzzle than something which has real meaning and logic. I regularly scan the web looking for tutorials on all sorts of programming subjects. While I avoid using code written by others for my own work, I do learn a lot by examining others code. What API calls do they use and why ? What is the basic logic to handling a specific task ? What I often find is that much of the code is unreadable or at least hard to grasp. In my opinion well written code should be easily understood, even if you come back to it years laters.

While even Basic can be abused by poor coding habits, the language does tend to lend itself to more readable code. I find languages like C++ to be too cryptic in nature, not readily readable.

Language more like natural language (what we speak).

I think this is important. The more cryptic a language becomes and the less it looks like the English language (at least for English speaking people) the harder it is to write code which lends itself to human logic. What I mean is that, when you write software, the ideas you are trying to bring to life are human tasks or ideas. It is much easier to convert a human task or idea into code when the code matches how we think (and speak). Just think of the simple syntax of Basic for moment. Let’s say I want to take the simple idea (or task) of counting from 1 to 100 and print each number to the screen. In DOS (or Console for Windows) Basic you would write it like this:

FOR X=1 TO 100
     PRINT STR$(X)                ' convert  a  number to text or a string and print it
NEXT X

Do you see how natural that is ? The FOR statement is self explanitory. Just look at how the FOR statement is done in C++

 for (int i = 1; i < 101; i++)

Does that look natural to you ?  Look at all the parentheses and semi-colons in the code. Now to some people this may look natural to them, but if you asked a non-programmer which was more readable and natural, I would venture to say they would say Basic.

Instead of training ourselves to think like the programming language (ie. C++), Basic is a language which works like we think. True most programmers experience with Basic likely was when they were first learning to program and later when they were “turned on” to what everyone told them was a “more professional” language (ie. C++), they quickly drop Basic thinking it was not for the “mature” or “experienced” programmer. No one wants to be thought of as a beginner or inexperienced, right ?

The reality is, that Basic was such a great language simply because of its design and naturalness which should have been more appreciated. It could be compared to automobiles (aka. cars). The so called old fashioned vehicles of the past are often viewed of as obsolete, because there is all sorts of new technology today. Now if you ask those who love those old cars (called antiques) and restore them to like new, they will often say that in many ways the so called older cars were better built in many ways. For example, a car built in say the 80’s , it was usually easy to change the sparks plugs. Just 30 minutes or less and you were done. The spark plugs usually were on the top of the engine recessed in the valve cover and it took little effort to get them out.Now lets look at cars of more recent years. I remember a neighber saying to me that their car needed new spark plugs and it would cost $400 to have it done. I said that was crazy and asked why so much ? They said you have take apart the top of the engine just to get to the spark plugs and it would take a mechanic hours to do. So the newer technology may have had some benefits, but it was at a cost and it was not user friendly. Another example is how cars today make spark plugs last so much longer (many years) while the older cars you had to change the spark plugs ever year (or two). At first glance you would think the newer cars are better because of this, but you would be wrong in my opinion. Why ? I had a friend who was having some strange troubles from his car, so I asked him when he changed his spark plugs last. He said he couldn’t remember (maybe he never had). I told him he should replace the plugs immediately and that he would find that the plugs would most likely be nearly destroyed (not much left of them). He did so and I was correct. You see, the reason newer cars make spark plugs last longer, is not because they actually do, but it is because the computers onboard see that the plugs are not working well and the computer will start compensating to make the engine still run well, despite the plugs. It will change the fuel mixture and even the timing to compensate. The engine appears to still run well, but it will be at the expense of gas mileage. The computer will actually keep the engine running quite well, right up to the point where the plugs will be nearly destroyed. The old fashion cars could not compensate for bad plugs, so you would see early one when they were starting to wear out and you would change them. This actually made the cars more fuel efficient because you regularly kept the plugs in good order. Newer cars put a strain on the engine when the plugs get older, but you never know until the plugs are nearly destroyed (and that can’t be good for an engine).

Now everybody will tell you that the newer technology does things so much better than the so called old fashion technology. For example we hear all the talk about reengineering the cars of today so they can get 35 or better miles per gallon (since gas is so expensive) or to make them last so much longer. Yet, my 1990 Geo Prism (which only recently finally died, but I may yet try to bring it back to life again) which was a 20 year old antique by todays standards, got 40 miles per gallon right up to when it finally died (blew a rod bearing) and the engine lasted over 330,000 miles. I purchased the car with 149,000 miles on it and I still got another 180,000 miles out and 10 years of use. My more recent car (I have had it for about two years now) is a 1996 Saturn SL2 (which had problems where I had to rebuild the engine myself) gets over 35 miles a gallon (much larger car though than my Geo Prism) on the highway and it has a very good safety record compared to other cars and it even has plastic side panels which won’t rust out and the car is 14 years old. I am not a professional mechanic, but the engines design if so good that even I was able to rebuild it myself.

Computer languages can be very similiar!

Basic is the “old car” which is viewed as obsolete by many, but for those who have a good sense of value (and a little common sense) Basic has something that the  newer languages like C++ or even the so called “new” basics like Visual Basic dot.net don’t have. When Basic was created and as it grew to maturity (went from interpretor to a true compiler with some more modern constructs) something was done right. Thats why Basic just never seems to die, even though some have tried to kill it over the years. Colleges (education system) tend to not be friendly to languages like Basic, yet for some strange reason there are programmers who keep it alive.

Just check out the following web page to see what I mean:     http://basic.mindteq.com/

Or check out this web page:   http://www.thefreecountry.com/compilers/basic.shtml

While I am partial to Powerbasic, there are a number of Basic programming languages you can find on the web.

There is a reason Basic lives on, even though some would like to see it disappear. It is because Basic has many inherent advantages for coding which other languages lack in.

Because the core part of the Language has stayed the same with little change over many years, people can even convert code from 20 years ago to the more modern basic languages with a little effort.

Read my other articles about Powerbasic. I think you will find that a professional programmer can use Basic today, quite successfully.