1. Introducing Small Basic

Preview

In this first chapter, we will do an overview of how to write a program using Small Basic.  You’ll get a brief history of Small Basic and look into use of the Small Basic development environment.

Introducing Guide to Small Basic

In these notes, we provide a thorough overview of the Microsoft Small Basic programming environment.  We review the language of Small Basic and the objects used by Small Basic.  We also cover many advanced topics.  Along the way, we will build many Small Basic example programs to illustrate the skills learned.  You can use many of these code “snippets” in programs and applications you build.  All Small Basic code is included with the notes.

As a first step to this overview, we will review Small Basic and its development environment in the remainder of this chapter.  Then, we provide a review of the Small Basic programming language in Chapter 2.  Beginning with Chapter 3, we cover many of the objects included as part of Small Basic.  With each chapter, objects will be summarized and several example programs will be built to show how Small Basic can be used.  The notes end with chapters on advanced topics such as debugging, graphics, animation, sharing programs on the Internet, graduating programs to Microsoft Visual Basic and building libraries you can use in Small Basic.

The Developer’s Reference Guide

This chapter is adapted from the book The Developer’s Reference Guide To Microsoft Small Basic by Philip Conrod and Lou Tylee.

To purchase this book in its entirety, please see the Computer Science For Kids web site.

Requirements for Guide to Small Basic

Before starting, let’s examine what you need to successfully build the programs included with The Developer’s Reference Guide to Small Basic.  As far as computer skills, you should be comfortable working within the Windows environment.  You should know how to run programs, find and create folders, and move and resize windows. 

As far as programming skills, we assume you have had some exposure to computer programming using some language.  If that language is Small Basic, great!!  We offer two beginning Small Basic tutorials that could help you gain that exposure (see our website for details).  But, if you’ve ever programmed in any language (Visual Basic, C, C++, C#, Java, J#, Ada, even FORTRAN), you should be able to follow what’s going on. 

Regarding software requirements, to use Small Basic, you must be using Windows 7, 2000, Windows XP, Windows NT or Windows Vista.  These notes and all programs are developed using Windows Vista and Version 0.9 of Small Basic.  And, of course, you need to have the Small Basic product installed on your computer. It is available for free download from Microsoft.  Follow this link for complete instructions for downloading and installing Small Basic on your computer:

https://www.smallbasic.com

Introducing Small Basic

In the late 1970’s and early 1980’s, it seems there were computers everywhere with names like Commodore 64, Texas Instruments 99/4A, Atari 400, Coleco Adam, Timex Sinclair and the IBM PC-Jr.  Stores like Sears, JC Penneys and even K Mart sold computers.  One thing these machines had in common was that they were all programmed in some version of Microsoft’s BASIC.  Each computer had its own fans and own magazines.  Users would wait each month for the next issue of a magazine with BASIC programs you could type into your computer and try at home. 

This was a fun and exciting time for the beginning programmer, but the fun times ended with the introduction of the IBM-PC in the early 1980’s.  Bigger and faster computers brought forth bigger languages and bigger development environments.  These new languages were expensive to acquire and difficult for the beginning programmer to grasp. 

Which brings us to Small Basic, which I would call a relative of the early, original BASIC language.  The development of Small Basic is an attempt to rekindle the exciting days when just about anyone could sit down at a computer and write a simple program using the BASIC language.  Those of you who wrote programs on those old “toy” computers will recognize the simplicity of the Small Basic language and the ease of its use.  And, you will also notice Small Basic is a great environment for writing and testing code, something missing in the early 1980’s.  For those of you new to programming, I hope you can feel the excitement we old timers once had.  For the old timers, I hope you rekindle your programming skills with this new product.

Small Basic possesses many features of more powerful (and more expensive) programming languages:

  • Easy-to-use, Integrated Development Environment (IDE)
  • Response to mouse and keyboard actions
  • Button and text box controls
  • Full array of mathematical, string handling, and graphics functions
  • Can easily work with arrays
  • Sequential file support

Starting Small Basic

We assume you have Small Basic installed and operational on your computer.  Once installed, to start Small Basic:

  • Click on the Start button on the Windows task bar
  • Select Programs, then Small Basic
  • Click on Microsoft Small Basic

(Some of the headings given here may differ slightly on your computer, but you should have no trouble finding the correct ones.)  The Small Basic program should start.

After installation and trying to start, you may see an error message that announces Small Basic cannot be started.  If this occurs, try downloading and installing the latest version of the Microsoft .NET framework at:

https://msdn.microsoft.com/en-us/netframework/aa569263.aspx

This contains some files that Small Basic needs to operate and such files may not be on your computer.

Upon starting, my screen shows:

This window displays the Small Basic Development Environment.  There are many areas of interest on the screen.  At the top of the window is the Title Bar.  The title bar gives us information about what program we’re using and what Small Basic program we are working with.  Below the title bar is a Toolbar.  Here, little buttons with pictures allow us to control Small Basic. 

 

In the middle of the screen is the Editor.  This is where we will write our Small Basic programs.  To the right is a Help area.  Small Basic has great help features when writing programs.  This area will display hints and tips while we write code.

Running a Small Basic Program

Let’s write our first Small Basic program.  When you start, a new editor window appears.  You can also get a new editor window by clicking the New toolbar button.  Type these two lines in the editor window:

TextWindow.Title = "Hello Program" TextWindow.WriteLine("This is the first line of the program.")


The editor window should look like this:

Notice as you started typing the first line, this popped-up:

Small Basic has “intellisense” and uses this to make typing suggestions.  You can just keep typing or accept its suggestion by scrolling through the pop-up list and pressing the Enter key.

Also, notice this appeared in the help area:

Once you typed TextWindow, the help feature displayed all it knows about the TextWindow to help you in your programming.

The TextWindow is a Small Basic object.  It displays text output.  The object has properties, methods and events.  There are many objects in Small Basic.  They will be covered in detail in individual chapters of these notes.

Let’s Run the program.  Simply click the Run button on the toolbar to see:

This is the text window displaying the program output.  I have resized the window.  To stop the program, click the X in the upper right corner of the window.

That’s all there is to writing a Small Basic program.  Type the code in the editor window.  Click the Run button to run the code.  We will learn how to use a lot of Small Basic code as we work through these notes.  Chapter 2 reviews most elements of the Small Basic language.

Other useful toolbar buttons are:

Open – Open a previously saved Small Basic program
Save – Save a Small Basic program
Save As – Save a Small Basic program with a different name

We suggest saving each Small Basic program in its own folder. 

When you Save and Run a Small Basic program, four files are created.  If you name your program MyProgram, the corresponding files in the program folder are:

MyProgram.sb The codethat appears in the editor of Small Basic
MyProgram.exe A ‘compiled’ version of the code.
MyProgram.pdb A database file with information needed by your program
SmallBasicLibrary.dll The Small Basic run-time library.  It contains files that help your program run.

Do not modify any of these files outside the Small Basic environment.

There are also the Cut, Copy, Paste, Undo, and Redo buttons for common editing tasks.  They work just like the corresponding buttons in a word processing program.  Learn to use these – they will save you lots of time typing code.

Lastly, there are other buttons on the toolbar we will discuss in later chapters:

Import – Import a program from the Small Basic code repository
Publish – Publish a program to the Small Basic code repository
Graduate – Convert a Small Basic program to Visual Basic Express

Chapter Review

This completes our overview of the Small Basic environment and a brief demonstration of how to write a Small Basic program.  If you’ve used Small Basic before, this material should be familiar.  If you’ve programmed with other languages, you should have a fairly clear understanding of what’s going on.

After completing this chapter, you should understand:

  • A little of the history of Small Basic.
  • The various parts of the Small Basic integrated development environment.
  • The utility of “intellisense” and the Small Basic help panel.
  • How to write code using the code editor.
  • How to run a Small Basic program.

Next, let’s review the language of Small Basic.

Next Chapter > >

© Copyright 2010 By BibleByte Books. All Rights Reserved. BibleByte Books, the BibleByte Books Logo, Computer Science For Kids, the Computer Science For Kids logo, and related trade dress are trademarks or registered trademarks of BibleByte Books.