A co-worker was showing me an in phone scripting environment on the iPhone and I knew I had seen one mentioned for the Windows Phone before.  TouchDevelop is an app from Microsoft Research that allows you to create small applications that do a wide variety of operations including using most of the capabilities of the device.  So could this be a fun way for us geeks to waste some time while waiting for our oil to be change or a table to open up at your favorite restaurant?

So what does this language look like?  The structure for TouchDevelop applications is broken into three sections: actions, data and events. 

Actions are essentially procedures and can be run independently from the user interface as long as they are not marked private.  One action can also execute another action using the “code” section of “expressions” UI.

Variables that are defined in the Data section.  They are global to the application and are persistent by default.  The variable types include not only basic structures like strings, but also more complex system constructs like JSON, playlist and camera objects.  This isn’t where all of your variables reside as many variables are automatically generated when you create assignment expressions.

The events that can be handled are somewhat limited but are appropriate for the phone.  As with some of the specialized data types the events are based around the different sensors and services of the phone.

Now the syntax is a little strange compared to most of the languages that I have used in the past.  It is very plain English which can throw you when you are used to more terse programming languages.  You have to get used to the concept of a “wall” instead of console which uses syntax like the example below.

var1->post to wall

You also aren’t going to get a WYSIWYG experience with the TouchDevelop environment.  You will have to create your own visual controls through code.  It reminds me of righting for the Win16 API in C++, only with less built in UI abilities.  If you get to this point then you probably want to start by copying an application that already has methods to generate buttons, text boxes and other controls.

Just to give you a flavor of the environment there are a number of screenshots below.

Screen Capture-1Screen Capture-2Screen Capture-3Screen Capture-4Screen Capture-5

In the end it is a bit of a mind bending challenge to learn to develop with TouchDevelop, but getting out of your comfort zone is always a good thing.  Enjoy.