Computing Distance from GPS points in App Inventor

With App Inventor, you can create apps that use the LocationSensor to get the phone’s GPS coordinates. Some of my students have been writing apps to perform such public services as finding the closest pub from their current location. To compute this, they need to convert to GPS lat/long coordinates into a distance in miles.

To help them, I created these quick and dirty screencasts demonstrating how to find a formula on the web then convert it into an app inventor program:


Why App Inventor Works

Sharon Michaels wrote a great review of App Inventor and like many lauds its visual, drag-and-drop interface.  In teaching App Inventor for a year, I’ve seen that it does work for non-programmers and I’ve thought a great deal about why. Here are the key features of the language:

No syntax — The blocks language eliminates the need to remember and type code. When I teach beginners textual languages, their biggest pain is syntax, the blank page, and the cryptic error messages that Python/Java/etc. provides for them. Most beginners quit because of the frustrating experience of syntax errors.

Events at the top level — Traditional programming languages  were designed when the best metaphor for a program was “a program is like a recipe– a set of instructions”.

Since the advent of the graphical user interface, programs have not been recipes, but sets of event-handlers. “When this happens, the app does this. ” is the correct conceptual model.

With App Inventor, an app is a set of event-handlers. I know this is amazing, but you can say, “when a user clicks this button, ” by dragging out a block. Compare this with Java, which requires you to understand classes, objects, and listeners in order to express an event-handler. Even if App Inventor were a textual language, its 1st order events would dramatically ease the development task.

Choose from a set of options — The components and functions are organized into drawers. You program by finding a block and dragging it into the program. You don’t have to remember how to enter an instruction or refer to a programming manual.

Only some blocks plug-in — Instead of chastising the programmer with cryptic error messages, App Inventor’s blocks language restricts the programmer from making mistakes in the first place. For instance, if a function block expects a certain type of parameter, you aren’t allowed to plug in a different type. This doesn’t eliminate all errors, but it sure helps.

Concreteness — You program components, not abstractions. When you drag out a component, an object is created and function blocks created for it. This is a problem in terms of code reuse and program size, but the concreteness is a boon for beginners and is pretty nice for experts as well.

High-level components — The app inventor team has built a great library with simplicity the main goal. There are months of programming expertise embedded in the components.

The Programmers are coming!

Google has targeted education with App Inventor, but its clear that the tool will attract major interest from programmers and web designer/developers. Programmers see the potential because of the the TinyWebDB component which allows an App Inventor apps to communicate with web services.

Early adopter Dean Sanvitale has already built an RSS reader app and a Flickr explorer app. He did this by modifying a sample “tinywebdb-compliant” web service to create then writing an App Inventor client that talks to it. The pic on the right is his RSS reader app running in an emulator.

For more on how to build App Inventor (tinywebdb-) compliant web services, as well as sample source code, see and (The sample is written in Python/App Engine)

Good work Dean and, programmers, rev your engines!

App Inventor at Community Colleges

I just finished teaching a 5-day App Inventor workshop at MPICT, a conference for computer science and IT community college teachers in the Northwest US. App Inventor was a hit– many of the instructors plan to incorporate App Inventor in their courses.

What I learned is our community colleges are in good hands: what a fantastic group of teachers! I learned a great deal about teaching in general and teaching beginning CS courses specifically.