BASIC, OOP and Learning programming in the 21st century !

Does BASIC as a programming language have any value for those interested in learning how to program ?

Is BASIC a valid language for a professional programmer ?

Is OOP (Object Oriented Programming” the criteria for judging the value of a programming language ?

Recent blogs on the internet about Basic and its value as a programming language motivated me to write this article. Please read the following:

http://www.computerworld.com/s/article/9217820/How_are_students_learning_programming_in_a_post_Basic_world_?taxonomyId=11&pageNumber=1

http://blogs.msdn.com/b/alfredth/archive/2006/09/15/754417.aspx

http://blogs.msdn.com/b/alfredth/archive/2011/07/06/a-post-basic-world.aspx

What is most interesting is not just the articles, but the comments posted in response to the articles.  Such divergent viewpoints may confuse those interested in learning Basic, especially those who desire to program professionally. What is needed to balance out all these differing viewpoints is someone who has used Basic for a long time and who uses it professionally. I think my experience with Basic qualifies me to discuss this.

Before discussing Basic, I have to clear the air of one consideration. That is the value of OOP (Object Oriented Programming). OOP is often used as part of the criteria by some for how they judge the value of a programming language. OOP was originally intended to solve a number of problems for professional programmers. One example of this was Code Reusability. Also it encouraged component design (just pop a component into an application). Both reasons are noble and to some degree it did solve some problems. But like many things well intentioned programmers come up with, it also brought its own share of problems. OOP is not the panacea some often tout it as. OOP has not made programming significantly easier and it has not made programming significantly faster than in the past. It is true that high level, reusable code is important for faster and more reliable coding, but whether one uses OOP or simply procedural style coding (ie. subroutines/functions), the key has more to do with the quality of programmers themselves, than the style of coding. Maybe all the changes in software development over the years (every year a new programming style or language or system is introduced which is touted as the solution to all our problems) is more  a product of poor programmers rather than the programming tools. Everybody wants an “easy” solution to solve all our programming problems, but sometimes it simply comes down to learning how to be a good programmer. We need to get used to writing code and good code.

So if any want to get on the OOP bandwagon, realize that I am not alone in in this viewpoint (please read:  http://blog.dmbcllc.com/2008/05/13/object-oriented-programming-has-failed-us/ ). While I dabbled with some simple OOP when using Visual Basic, I am a long time Basic programmer and I have found that I am more productive with procedural style coding. After learning a good bit of the Windows API, I find there isn’t much I can’t do using procedural style coding.

Now let’s get back to Basic. Basic is a great language to learn how to program with. I am also not refering to the latest generation of Visual Basic (dot.net version), since VB.net changed Basic too much, so it is more of step child of C#, than actually Basic as we know it. While I think some support for OOP in Basic is good, OOP should not supplant the core Basic we all love and know.  There are different flavors of Basic and this is good, since people differ in how they like to program and the different flavers satisfy different people. Some Basics are geared towards game developers, so they have command sets which make things like DirectX easy. Some are more OOP in nature for those who just need OOP no matter what. Others are geared towards professional programmers who need a more rounded Basic (thats what I prefer). Some are multi-platform, while others target Windows only. My suggestion is try as many of them as possible. One of the Basics will stand out and meet your fancy.

For those interested in Basic, I will start out by making some suggestions of what to try:

First check out this web site , since it lists more Basics than you may imagine even exist:  http://basic.mindteq.com/ 

Ok, which Basics should you start with ? For those who want to write Games or anything very graphic in nature try:

BlitzMax:  http://www.blitzmax.com/

CreativeBasic and IWBasic:  http://www.ionicwind.com/

DarkBasic:  http://www.thegamecreators.com/

While I don’t promote or encourage development of violent video games using Basic, the above Basics are very graphic orientated and well suited to any graphic orientated programming.

If you want a nice general use Basic scriping language, then I suggest ThinBasic:  http://www.thinbasic.com/   ThinBasic is an amazing scripting language and deserves notice.

If you want something made by Microsoft, which is more OOP oriented then consider:  http://smallbasic.com/

Small Basic is more OOP oriented than procedural and not really my favorite because of that, yet many find it useful. Personally, I think that if you want to really learn what it means to program, you should stay away from the languages with overriding IDE’s (coding environment) and try languages which require you to write a lot of code with a simple text editor without all the fancy syntax helpers. Get used to a lot of hand coding. You can use the fancy tools later (and you may find them less impressive than expected).

There are many more Basics out there, but this should get you started. Ok, so what Basic do I use ? I started in the mid 70’s using interpreted Basics, then later the Abacus Basic compiler for the Commdore 64, QuickBasic 4.1 compiler , PDS 7.1 compiler and then I dabbled with Visual Basic. I finally found PowerBasic and that is what I have been using ever since. While when I first found Powerbasic its GUI command set was nil (did not exist), I recognized the power of the compiler itself and started learning the Windows API. Today I develop programming tools for use with PowerBasic. PowerBasic, in my opinion is one of the industries best kept secrets.

Now before anyone steps in and says “Basic” is old fashioned and obsolete, let me say this much. To appreciate any programming language, I personally think one should be exposed to computer machine language.  You need to understand how a CPU really works and the kind of instructions it uses, before you can fully grasp what a programming language must do. You need to appreciate the difference between a compiler and an interpreter (a script language). You need to appreciate how some languages use runtimes. For example the more current languages often use the dot.net runtimes, which are huge. This means the language does less and the runtimes do more of the work. This is not always bad, but one must appreciate that some programming languages have less control of the computer than you may think. One of the reasons I really like Powerbasic, is that it generates real low level machine code most of the time (some times it must call the operating system of course). One of the problems today in programming is that so many higher level frameworks have been added to the operating system (particularly Windows) that even though computers are so much faster today, they run terribly slow. You may see the term “bloated software” thrown around some times, which basically means the software is too big and too slow, so the computer runs very slow. A good example are the latest Netbooks and Tablet PC’s running Windows 7. The average person is under the impression the hardware in these computers are terribly slow, to the point of being almost useless. This is not true. I was writing software some years back which was run on a 100 mhz CPU (which was considered fast at the time) which less than 32 meg ram. The Netbooks of today come with 1.5 ghz CPU’s which are 15 to 30 times faster than the CPU’s I use to work with and they come with 30 to 40 times more memory than the computers I used to work with. You actually have a powerhouse computer today, even with the cheapest Netbooks.

I appreciate machine language myself, since I learned some x86 assembler years ago and 6502 machine language. I was pretty adept with 6502 machine language to the point where I wrote my own Basic compiler for the Commodore 64 (I used the Abacus Basic compiler to write my compiler). Ultimately, all programming languages must convert their code to some form of machine language and this determines how fast the software will run. A well written Basic language compiler (like PowerBasic) can stand its ground with any other language compiler, even C.

The beauty of Basic is actually is long history. Its been around for so long, that there is so much basic code around to learn from. Basic has also grown and matured. Rather than stand still, it retains the things which made Basic so great, but has incorporated the best of newer, younger languages. PowerBasic for example today supports OOP, pointers, COM, inline assembler, calling code via pointers and more. Yet, it is still Basic and some code I wrote even 20 years ago (non-user interface) sometimes still works with it. The long history of Basic is one of its strengths, especially Basics which maintain the code syntax of Basic of long ago.

If you are hobby programmer and you want to experiment with Basic, I would suggest one of the Basics mentioned above. PowerBasic even has a less expensive version of their compiler called “Classic Basic” which is a great tool if you want to really do some complex stuff. See:  http://www.powerbasic.com/ 

Now if you wonder what kind of stuff I have been able to write using PowerBasic, consider this:

– a Drag and Drop Visual Designer (WYSIWYG)  with Code Generator

– custom Windows controls such as Masked Edit, Turtle Graphics, Canvas, GLCanvas, Files Listbox, Proper5ty Listbox, 3D Buttons, Shape/HotSpot/SplitterBar and MCI control

– My Canvas control has a proprietary software based 2D Sprite (animation) engine

– My GLCanvas control has a proprietary 3D OpenGL based scripting language

You see, I write some very complex software (which other programmers use) and all using Basic. Basic can even be for professionals!

So if you haven’t tried a Basic programming language, why not try one today!