Microsoft Small Basic
Encyclopedia
Microsoft Small Basic is a simplified variant of the BASIC
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....

 programming language introduced by Microsoft in October 2008. With a bare minimum of concepts, Microsoft accredits this as an easy programming language for beginners to grasp. The language itself has only 14 keywords, and the environment is beginner-friendly, with a straightforward interface. Small Basic Version 1.0 (12 June 2011) was released with an updated Microsoft MSDN website that included several new Small Basic guides for beginners through a partnership with ComputerScienceForKids.com. The published Small Basic guides include a complete Developer's Reference Guide, a Beginning Small Basic tutorial, and a republished classic programming book by David H. Ahl.

Microsoft Small Basic was designed by Microsoft DevLabs and released as a Technology Preview in October 2008. Its intended audience is anyone looking to begin programming, including children and beginner adults as well.

Language

The actual language is a modified version of Microsoft's QBasic
QBasic
QBasic is an IDE and interpreter for a variant of the BASIC programming language which is based on QuickBASIC. Code entered into the IDE is compiled to an intermediate form, and this intermediate form is immediately interpreted on demand within the IDE. It can run under nearly all versions of DOS...

 language, but ported over to the .Net Framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

. The traditional 'Hello World' can be written as:

TextWindow.Write("Hello World")

or:

TextWindow.Writeline("Hello World")

The first example just writes 'Hello World', but the second example writes 'Hello World' on a new line.

Note that traditional Basic variants, including Microsoft QuickBasic, used an easier syntax:

print "Hello World"


The language itself is Turing complete and supports concepts like conditional branching and loops. Variables are typeless and dynamic, and there are no scoping rules. The language supports subroutines and the runtime uses them for event handling purposes.

Conditional Branching


TextWindow.Write("Enter the temperature today (in F): ")
temp = TextWindow.ReadNumber
If temp > 100 Then
TextWindow.WriteLine("It is pretty hot.")
ElseIf temp > 70 Then
TextWindow.WriteLine("It is pretty nice.")
ElseIf temp > 50 Then
TextWindow.WriteLine("Don't forget your coat.")
Else
TextWindow.WriteLine("Stay home.")
EndIf

Looping


TextWindow.WriteLine("Multiplication Tables")
table = 4
For i = 1 to 10
TextWindow.WriteLine(i + " x " + table + " = " + table * i)
EndFor

Libraries

The software ships with a built in set of libraries which are quite modern and intended to pique the learners' interest.

For example to change the desktop wallpaper to a variety of 10 mountain photos, the students would make use of a prebuilt "GetRandomPicture" method for Flickr so the code becomes simply:
For i = 1 To 10
pic = Flickr.GetRandomPicture("mountains")
Desktop.SetWallPaper(pic)
Program.Delay(10000)
EndFor

Turtle

Microsoft Small Basic ships with a Turtle graphics library that borrows the idea from Logo
Logo (programming language)
Logo is a multi-paradigm computer programming language used in education. It is an adaptation and dialect of the Lisp language; some have called it Lisp without the parentheses. It was originally conceived and written as functional programming language, and drove a mechanical turtle as an output...

. For example, you can make the turtle draw a square by simply saying:


For i = 1 to 4
Turtle.Move(100)
Turtle.TurnRight
EndFor


Older Basic dialects, like Microsoft QuickBasic, did not use EndFor but Next i

Testing

The first trials were successfully done with several middle school children, most of them children of workers at Microsoft. Small Basic was also successfully tested using a hands-on lab approach to a group of 25 high school girls.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK