Learn How To Write Computer Program with SmallBasic
Somebody at Microsoft is doing things right in my humble opinion. What they’ve done with Small Basic is reintroduce hand-coding software, but with just a little less help than drag-and-drop or WYSIWYG interface. Let’s take a look at at it shall we?
Take a look at the interface. Doesn’t look like much more than a prettified Notepad, does it? Well, in many ways that’s what it is. No Object Toolbars, no colour selectors, no fancy element properties windows. Just you, a keyboard and a screen. That’s the beauty of it. Immediately, it showed me my weakness, my dependency on wizards and ready-made objects. As I stared blankly at the screen, I tried to think of just one Basic command that I could get started with. Nothing.
Now, in my defence, I haven’t written a Basic program since college. Yet, even then we were taught on VisualBasic 6. So I first looked for the elements that I could just drag into place. None. Nowhere. My next move was to do the unthinkable – go to the documentation. But wait! There isn’t even a Help menu. I remembered good old F1. Nothing!
I went to the Program Menu from my Start Button and looked under the directory for Small Basic. There it was, the thing that really makes this program worthwhile – the Introducing Small Basic (ISB) document.
As all good introductions to programming guides should, the ISB started me off with a “Hello World” program. If you’ve done any learning of programming languages, you’ll know what that is. The ISB says you just type this line in:
I started typing…T..e…x…what? What is this thing that came from nowhere with information just for me? That’s the Intellisense function of the application.
This is what separates Notepad from Small Basic. Whenever it senses that I am typing something meaningful, it will show me a list of options that you can scroll through using your up and down arrow keys. Each item has a short description beside it so I can decide if this is what you need, and how to use it. When I find the term that I want, I strike the enter key and it will auto-complete for me. This is such a nice happy medium between coding in Notepad and being lost in the gloss of the latest full-blown VisualStudio. I think you’ll like it.
Once I have my “Hello World” program done, I can save it by clicking on the Save As button.
Then I can run it by clicking on the Run button. Or, as the button shows, I can also press the F5 key to run it.
So let’s run it and see what happens.
The program opened up a Command window, or DOS window as some call it, and printed out “Hello World” just like I told it to. Since I didn’t write anything to tell the program what to do next, Small Basic automatically gives me the Press any key to continue… prompt.
Now, a bit about shortcut keys since I already touched on the F5 keys. Many of the popular shortcut keys do work with Small Basic, such as ctrl+s for saving.
If you’re thinking this is pretty rudimentary and simplistic, you’d be right. Yet, that’s the point of it. The point is to give the new programmer a usable environment, decent documentation and the spartan workspace needed to develop life-long programming skills and practices. In just 69 pages, the ISB document teaches the new programmer about variables, arrays, conditions and branching, and loops. With these basics of programming, you can go a long way.
If you’re also thinking that the programs that you could do with Small Basic would be useless or visually boring, think again. Small Basic does give you the ability to use interactivity with your user, create graphics and use colour. Another neat built in object is the Turtle. Turtle makes Small Basic a useable platform for teaching kids to program. Who can resist telling a Turtle to move 100 spaces and then watching it go? Or how about watching Turtle draw a fractal?
Old pro or newbie, or proud parent passing skills on to the offspring, Small Basic is a seriously fun tool for programming with. Give it a try. Let us know what you think about it.
Have you already done some work in Small Basic? Show us where we can see a sample in the comments below.