Saturday, October 16, 2010

App Inventor for Android is the future of programming

I recently spent some time playing around with App Inventor for Android. I've even put together a simple app to allow the creation of text messages using Speech Recognition and the ability to listen to SMS replies using Text to Speech, two features that are built into Android. It took me about 45 minutes to create. If you're interested, you can download the app on my Google Code site. It's called Talk And Text.

Google is marketing this tool as being usable by non-programmers, but I think that App Inventor is way too complicated for the non-Geek. It has logical constructs such as loops and function calls built in, something you need some programming experience to understand.

App Inventor works with a Designer view, a webapp for building the GUI using a WYSIWYG screen creator and a Block Editor for wiring visual and non-visual components together. Most programmers have used a GUI builder in an IDE, but the Block Editor is where the app comes to life and where App Inventor moves programming into the future.

Here is an example of one of the blocks in Block Editor from my Talk And Text app:


In the Designer view, I selected an instance of the Texting component used to send and receive text messages. It is called Texting1 in the Blocks Editor. The shown block represents a method called MessageReceived of Texting1 with two parameters, one representing the phone number of the SMS sender (named number) and the other representing the message text (named messageText) of the received message. The method body (the 'do' section of MessageReceived) contains calls to:
1. Display the message and phone number in various text boxes on the page.
2. Save the phone number to a preferences store ('Tiny DB').
3. Speak the SMS message using the Text to Speech API.

While method calls and value assignments in Blocks Editor 'code' are obvious, it should be pointed out that the real Android API differs somewhat from the 'Blocks API.' That is probably related to the attempt of Google to make the Android programming easier for non-technical types. Still, App Inventor compiles data from the Designer and Block Editor views into byte code that can be run on an Android phone.

But you don't have to be an expert on the theory of computer languages to figure out the language of App Inventor. The Blocks Editor comes with a series of build-in blocks that represent such things as boolean expressions and conditional statements. Object properties are also exposed as are setter methods for assigning a value to them. There is also some 'type safety' built into the blocks as only certain ones fit together (fit is confirmed with a clicking sound).

The language of App Inventor is not as complete as you would expect in a modern computer language. For instance, you can't do complex expressions. And the library of built-in blocks is limited, which is primarily due to the newness of App Inventor and Google's intent to keep it simple.

The brainiacs at Google have put together something ingenious with App Inventor (with the acknowledged help of open-sourced predecessors including the Open Blocks Java library) that I think is a glimpse into how we will program in a decade or so. I believe that this paradigm shift will combine App Inventor's 'lego blocks as code' concept interspersed with snippets of source code text. Although I've been a programmer for about 15 years now, I am no computer language maven. Still, my programmers intuition tells me that App Inventor -- rather, its evolution -- will be the future of computer programming.


Afterward: It has been pointed out to me that this genre of programming owes its roots to languages used to teach programming to kids such as Logo and Scratch and is being expanded by the Build Your Own Blocks (BYOB) program at U. Cal. Berkeley into a programming language to 'serve kids and computer scientists'. App Inventor's resemblance to BYOB is unmistakable.