Wednesday, July 29, 2009

Programming Made Simple!

In the 90s, a big company from up north was extremely successful with a dialect of the programming language BASIC (acronym for Beginner's All-purpose Symbolic Instruction Code). One of the reasons it was so successful was that the language was easy to learn and use.

Bringing an easy to learn and use language to the mobile world and the Android platform is the goal of the Simple project. Simple is a BASIC dialect for developing Android applications. It is particularly well suited for non-professional programmers (but not limited to). Simple allows programmers to quickly write Android applications by using the components supplied by its runtime system.

Similar to its 90s relative, Simple programs are form definitions (which contain components) and code (which contains the program logic). The interaction between the components and the program logic happens through events triggered by the components. The program logic consists of event handlers which contain code reacting to the events. In reality it is even simpler than this description.Let's see how simple it really is. We will quickly write a program simulating the famous Etch-A-Sketch on an Android device. Tilting the device will move the pen, shaking the device will clear the screen. The Simple runtime system gives us three components to provide most of the needed functionality:

The code defines two global variables (lines 1 and 2) and two event handlers, one to handle changes in the device's tilt (lines 4 to 17) and another to handle shaking of the device (lines 19 to 21). The code in the firstevent handler makes sure to only react to tilting above a certain degree (lines 6, 8, 11 and 13), and if that is the case then it further ensures that the pen does not run off the drawing surface (lines 7, 9, 12 and 14). And finally a point is drawn at the pen position (line 16). As for the other event handler, the only thing it does is clearing the drawing surface in case of shaking (line 20).

Last part missing is the form definition. It defines the form and its properties (lines 24 to 27), followed by the components it contains (lines 28 to 33).

That's it. The only thing left to do is to compile and deploy the application to an Android device. And voila, here is a screenshot of the application running:

For a definition of the Simple language see the Simple Language Definition (download, 199 KB PDF). For more information on writing Simple applications see the open source project page at code.google.com/p/simple. You can also find information there on contributing to the project, and we encourage you to join our discussion list to provide us feedback.Programming made Simple!

(This is a copy of my original post on the 'Open Source at Google' blog)

I think you are about 2 decades off for the NW software company. That was the 70's that Microsoft developed Applesoft Basic, GWBasic, MSBasic, later QuickBasic and eventually Visual Basic (variants for different platforms and operating systems). It is the application that started Microsoft and to this day still has people using software written in it.