TouchDevelop and the future of mobile application development


If you have a Windows Mobile 7 phone, and haven't tried out Microsoft Research's TouchDevelop app, you need to stop and go check it out as it's one of the neatest projects I've seen in years. It's a mobile scripting app released last summer that lets you quickly and easily write programs on the handset itself. It combines a custom scripting language, an on-phone development environment, a bunch of useful APIs (including all the hardware functions, as well as fun stuff like a physics engine), and a social script sharing site into an incredibly innovative new dev platform. Seriously, this stuff is as amazingly cool and cutting edge as it gets in mobile.

The project's team has been constantly upgrading TouchDevelop's capabilities since it launched, adding more APIs and tweaking the scripting language. And last Friday they released a packaged runtime so you can download the scripts you've written on the phone as a ready-made .xap file, which can then be uploaded directly to the Windows Phone Marketplace as a standalone app. How insanely cool is that? You can actually create good looking, incredibly useful mobile apps directly on the mobile itself. It's the beginning of a bootstrapping process which elevates mobile devices from peripherals towards being standalone systems in the same league as PCs. It's a revolution akin to HyperCard, the original Visual Basic, or the first Web Browser - it's that amazing.

Here's an app I wrote using TouchDevelop, which just got published to the Marketplace today: MinuteMatch. Here's a screen shot:


It's basically a match three game with a time limit and a leaderboard. It's not overly complex, but the point is that I wrote it entirely on a phone. Then I was able to download the packaged version and submit it as an app to the Marketplace, the same as if I had written it using a PC and Visual Studio. That's pretty astounding.

When the project launched last year, I was sort of in the right place at the right time last year to try it out. Nokia had decided to embrace Windows Mobile, which meant that I had gone out and gotten a new Samsung Focus to get more familiar with the OS. And, as a part of my job in Nokia Research Center's marketing group, I subscribe to a bunch of different research blogs, including Microsoft's, so I saw the project as soon as it was announced. I was immediately smitten with the idea of creating scripts on a handset and started creating a bunch of them. I was particularly excited about developing games, just to learn how to do them and ended up creating a bunch of different variations. Developing games became what I did on my phone during those random moments, rather than just simply playing them. How cool is that?

Here's some examples of the scripts I wrote and published last year:

MinuteMatch V1 - The first version of my match-three script using shapes.

SaveTheBubble - A simple 'one-touch' app which uses the integrated gravity physics and graphics.

BreakIt! Touch - A Breakout clone which used touch to play. I also wrote another version using a handset's tilt controls.

LetterDefender - I made a version of my big program I created on the TRS-80 (which I wrote about here).

MegaPegs - A Peggle-style game where you watch the ball drop and bounce off pegs which disappear. I had to learn about vector physics to make this work like I wanted it to, but it was all supported in the APIs.

HundredBubbles - A simple game where you had to touch bubbles which slowly rose to the top of the screen.

SpringTest - This was just a simple script I wrote to test how the 'spring' object was supposed to work and it ended up being very soothing to play with - it uses the tilt controls to fling the balls around which then bounce and swing slowly back into place.

Wallpaper Maker - I wanted a background that was clean, yet colorful, so I created a random image maker into an app to scratch that itch.

The ease in which you can quickly write code with one finger using TouchDevelop is pretty surprising. This isn't like the various 'coding' apps on the iPhone or iPad I've seen, which are basically slightly enhanced text editors and an interpreter. By using their own scripting language, and controlling all the facets of the development environment, the researchers developing the app were able to reduce much of traditional coding down to choosing from various option buttons and menu lists.

It's hard to describe how useful - and different from traditional IDEs - this is until you use it. For example, when you create a variable it's tracked within the application in a symbolic way, rather than just by the name you gave it. This let's you give a variable a descriptive name, with spaces, etc. Later, if you change the name of the variable, it's automatically changed everywhere it's used! Another example: TouchDevelop's equivalent of functions (called 'actions') support multiple return values. This may seem odd to programmers of C-style languages (including Java, Javascript, etc.), but it actually enables insanely easy refactoring: Any chunk of code can be selected and automatically be pulled out into a separate action. The variables needed by the instructions in those lines of code become required parameters, and any new variables created or modified become the action's return values. Combining this sort of thing with predictive options, and list priorities based on usage reports reported back from the app (it's a research project after all), means that you can actually create and manage apps with hundreds of lines of code quickly and easily with - literally - just one finger.

Yeah, but how easy is it for someone who's not a developer in the first place? Well, last summer my son and I were on vacation and driving from Tahoe down to Yosemite along a 4 hour stretch of Nevada highway. We started to talk about computers and programming, and he wanted to learn how to do program. So I gave him my phone and talked him through, step by step, how to create some fun little scripts which covered the basics. While I was driving, my son created his first program ever using a mobile phone. Here's his script - a multiplication test. How awesome is that?

You know, what's almost better than the code editing stuff in TouchDevelop is simply the abundant APIs and the ease with which you can prototype apps which use pretty much every sensor and function on the phone - from the address book, to the gyroscope and compass, to the camera and Internet connectivity, to voice functions and media. Never before has so much hardware and OS functionality been so widely opened to handset developers in such an easy-to-access way. Even newer development libraries like PhoneGap which use plain HTML and Javascript to access OS functions and develop mobile apps don't come close. I will admit that it can be somewhat frustrating that all this functionality is so tightly tied up with TouchDevelop's handset-only dev environment and scripting language. Being able to do quick-and-dirty scripting in a language we're all more familiar with (like, say, Javascript) with an actual keyboard and mouse would be awesome. But that's honestly a pretty short-sighted criticism. If you want to create an app with a computer, you've got plenty of options. It's the on-device editor that's so cool.

It's been my contention for a while that as mobile devices such as phones and tablets get more functionality, the need for power users to be able to script them will increase accordingly. TouchDevelop's easy-to-use environment shows how this could easily be implemented in a way that doesn't require anything but the device itself. Also, think about the fact that for many millions of people around the world, a handset will be their first experience with computers - this project shows how you don't need anything but the device itself for those people to develop their own custom apps.

Okay, time to stop raving. But seriously, as much as I criticize and am generally annoyed by Microsoft, they definitely are capable of doing some really amazing stuff, as their research org has plainly shown with this project. It's an absolutely fantastic bit of work, and as cool as it is now, you can see even more possibilities in the future. Definitely go get TouchDevelop if you have a WP7 phone around, or if you don't have one yet, this might be worth going to get one just to play with it (preferably a Nokia Lumia, of course, so I can keep getting a salary).


< Previous         Next >