Introducing Microsoft Small Basic

For the past few weeks, I’ve been playing with Microsoft Small Basic. Small Basic aims to put the fun back into programming by making it easy for children and adults to learn computer programming.

It is the brainchild of Vijaye Raji, a Microsoft employee. It started off as a research project, but has now been released to the community so that Microsoft can gauge people’s interest in the product and get suggestions/feedback for future versions. The current version is 0.8.

Small Basic is deliberately simple. It comprises three distinct elements:

  • The Language
  • The Environment
  • Libraries

The Language

Small Basic takes its inspiration from early variants of the BASIC programming language, but has been built using Microsoft’s .NET framework. The language consists of just 14 keywords, so it is very easy to learn.

The language has no type system – so text strings and numbers can be assigned to variables and the value will be inferred from the content – so “1” + 2 is perfectly valid and will produce an answer of 3.

There is also no concept of “scope” – all variables are global and are always initialized. So there’s no need to declare a variable before you use it. Similarly, there are no classes or interfaces – all “objects” are static.

Small Basic also contains a very simple event-handling mechanism. You can write a subroutine and assign it to an event – this “wires up” the event to the routine that will handle it.

The Environment

The programming environment is very simple. A program consists of a single text file, and there is no need to declare a “Main” function or other entry point:

image

You can have multiple program files open at once, but there’s no easy way to switch between them, as there’s no “Window” option on the ribbon-style toolbar.

If you write a program that you’re particularly proud of, you can publish it to the Small Basic website and make it available to others. Likewise, you can import programs that have been published by others.

The “Graduate” option will take your Small Basic program and create a Microsoft Visual Basic.Net project from it, but I found this to be a bit unreliable. Offering an “upgrade” path like this though, is commendable.

Libraries

Libraries are groups of related areas of functionality that you can use in your Small Basic programs. Examples of some of the built-in libraries that come with Small Basic are:

  • TextWindow – for simple Console-style applications
  • Turtle – just like the old LOGO turtle from school days
  • Clock – provides access to the system clock
  • File – exposes methods for creating and copying files and folders
  • GraphicsWindow – for drawing and animating shapes
  • Desktop – allows you to set the desktop wallpaper
  • Flickr – get images direct from the Flickr website
  • Dictionary – get word definitions from an online dictionary

There’s a lot of useful stuff here and if there’s something missing, you can create your own libraries in any .Net language and use them in your Small Basic programs – how cool is that?

Useful Links

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Silverlight 4 Hands-On

I recently had the opportunity to get some hands-on experience with Silverlight 4 in Visual Studio 2010.

When you start a new Silverlight 4 project, you’re asked which version of Silverlight you want to target – 3 or 4. Seeing as version 4 is the latest, I opted for that, only to get a prompt to download this update. This installs not only the Silverlight 4 tools for Visual Studio, but also a new version of the WCF RIA Services library.

WCF RIA Services simplifies traditional n-tier development by bringing together ASP.NET and Silverlight using Windows Communication Foundation (WCF). WCF provides a pattern to allow you to write application logic that runs on the middle-tier that controls access to data and services.

It also provides a rich framework for common business application development scenarios such as validation, authentication and user roles.

After installing the update, you get two new Silverlight project templates that showcase the new RIA Services functionality:

  • Silverlight Navigation Application
  • Silverlight Business Application

The Silverlight Navigation Application template is interesting because it also demonstrates the new navigation framework in Silverlight 4. This allows you to create Silverlight pages that are associated with the browser’s forward and back buttons, something which had been either difficult or impossible to implement in previous versions.

All in all, Silverlight 4 represents a major step forward and brings a compelling set of new capabilities to the line-of-business application developer.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5