Wednesday, August 4, 2010

Rapid cloud development using App Engine for the Cycle Hire Widget Android application

Update Oct 2010: It's been several months since we introduced you to Little Fluffy Toys and their exciting Google App Engine story. Since then, their app has continued getting rave reviews. We're happy to let you know that there is a great follow-up to this story from the Android and UI/UE/UX perspective, and you can find it here:

This post is another entry in our ongoing series of guest posts contributed by App Engine developers. Today we partner with Little Fluffy Toys Ltd to tell the story of how they were able to learn App Engine (plus Python) and launched their service paired with their Android application in less than a week!


Last week, Little Fluffy Toys Ltd (LFT) launched an Android app to help its users find bicycles and rental locations in London. While this story doesn't sound particularly phenomenal, how they accomplished this using Google App Engine (and Android) makes their application and its launch one of the most exciting success stories so far in 2010.

The development team at LFT were able to quickly come up-to-speed on learning a new programming language and development environment in order to build and launch the App Engine backend service for their Android mobile app to the world in less than one week. The executive summary:

  • Attended 1-hour Thursday night presentation on Google App Engine (Jul 22)
  • Started to learn Python and App Engine on Saturday afternoon
  • Launched live service Wednesday, announcing their Android app with an App Engine backend (Jul 28)

Before we get to the good stuff, a brief backgrounder on the project which spawned the application: metropolitan bicycle-sharing systems, specifically London's. Based on the success and popularity of the Paris VĂ©lib' system, the Barclays Cycle Hire scheme originated mid-November back in 2008 from its mayor, a strong cycling proponent.

The system launched on July 30, 2010; however a month before the project reached its completion, a call for apps was given by the mayor seeking independent developers so that there would be a variety of mobile and web apps available by show time. Enter Little Fluffy Toys Ltd which ended up creating the Cycle Hire Widget app for Android. They needed a backend system to manage the data, found App Engine, and the rest was history. Shortly after going live with their app and the launch of London's bicycle rental system, I had a chance to discuss how their project came together with the help of App Engine.

NOTE: Cycle Hire Widget is only available in the Android Market if you are located within the UK. If you wish to view the application from outside the UK, please download and install it from within your Android browser via this link — bear in mind that the distances to your nearest rental/hire location will be ridiculous!

App Engine and LFT

As we mentioned above, the sole purpose of their App Engine app is to receive data from and provide data to the Android app running on users' mobile phones. The App Engine stored data is "global" for all mobile clients out there, and this includes names, locations, and dynamic specifics related to each bike station such as the data found in the app's screenshot below. Take note all the valuable data that is provided in real-time by App Engine:

If you're a bit familiar with App Engine, you would no doubt have heard about it as a platform for web applications, but this is a use case highlighting App Engine for a non web-based server-side application where no part of the app is user-facing save for what gets sent back to the mobile app. While this type of app doesn’t get much press, it’s more common than people think.

I met Kenton Price, the director and chief architect of Little Fluffy Toys Ltd, at a developer event recently, and he seemed to think that App Engine would be the right tool for the Cycle Hire Widget. It turned out to be true(!), and when I asked about LFT's needs and how they were met by App Engine after their successful product launch, here is what he had to say:

"As you know, we were massively against the clock with the launch of the cycle hire scheme, and we needed something we could get going with fast that would effortlessly scale to perhaps tens of thousands of mobile users. App Engine seemed the perfect choice from what we had read of it before the meeting, and after your presentation it was obviously the way to go. Your recommendation to use Python was scary given neither of us knew a thing about it, but then again we only knew Java from Android not from web development so we didn't have the domain knowledge of building Java web services. So we went with Python, and it worked out really well. I'm astounded how we actually delivered this product in a very short space of time when we both have full schedules working on projects for our clients and other demanding outside interests. Particularly satisfying was having a solution that was agile and flexible enough to enable us to display live cycle availability data within hours of it becoming unexpectedly available at the launch, so we were live in the field with real-time data that very same launch morning, a feature our competitors are still struggling to replicate."

Development experience

Reuben Harris, LFT's chief technical officer, is the lead App Engine developer for the Cycle Hire Widget. He had a great experience even though he was new to Python as well as App Engine. What excited him the most, and what was his development experience like? He tells his story here:

"The single coolest thing about this project is that it was possible to go from a state of knowing nothing whatsoever about App Engine or Python (other than the mile-high view) to having a working and useful application inside of eight hours. We're long-time geeks but we're not geniuses. For us to pick up a new language, a new SDK, a new environment, a new way of doing things, and produce anything of value at all in such a short time speaks volumes about the value, potential, and quality of App Engine and Python.

After installing the App Engine SDK, yes, the very first thing I did was your online tutorial. I did "Hello World" to find my feet then continued into webapp, since a clean URL handler with easy ways to get at HTTP variables seemed essential. Then I immediately jumped into learning about data storage. And wow, what an enlightenment that turned out to be! Goodbye SQL, don't think I'm going to miss ya.... :-)

Since the app's purpose is to manage just ~400 simple objects representing Cycle Hire Stations, each of which contains only Plain Old Data types — no object references or anything possibly messy — I felt I knew enough to implement it now, and so I dived in. And it was so easy! I started with a handler to rebuild the datastore from scratch. Then I wrote a "get" type of handler to retrieve information about groups of hire stations (returning the data in JSON). Finally I wrote an "update" handler so that updated information about cycle hire stations could be posted, and that was it. Job done.

One thing that initially confounded me was an HTTP 500 error caused by our "reset" handler exceeding the 30-second request limit. For a while I was ready to despair; HTTP 500s to anyone with much ASP experience usually means a hideous low-level bug somewhere! However, once we discovered the problem, this was easy to fix by splitting the work into multiple requests (/reset1, /reset2, etc.) It's an admin function that only we'd ever be using, so no harm done and no need to work out anything more clever.

I know we've barely scratched the surface of what can be done with App Engine. We've yet to use Memcache, background tasks, batched updates, or anything beyond simple cloud-based data storage. But that simple thing alone seemed then, and still seems, not far short of miraculous. To not have to worry about databases, servers, uptime, upgrades and above all scaling... to not have to think about any of that at all is such an immense freedom. I'm completely hooked on it and am unlikely to go back to my traditional server tools of MySQL and PHP.

To see Reuben's work in action, check out this video demonstrating how to use the Cycle Hire Widget app while roaming the streets of London seeking a bike to rent/hire or park:


Since the launch, the Cycle Hire Widget has gotten rave reviews from CNET, The Guardian, and The Londonist. It has even been featured by the Press Association of the UK and Ireland! One user commented on Android Market: "Can't really think of a way to make it better," a sentiment reflected in its very high feedback rating. It certainly does sound like quite a success. What does the future look like? I asked Kenton about how LFT came about as well as how they're looking to improve their succeeding offerings, and here's what he had to say:

"We formed Little Fluffy Toys Ltd as a vehicle for Android development where we do consultancy work as well as our own stuff like the Cycle Hire Widget and Social Wallpaper. Whilst all custom development enquiries are very welcome, we're also interested in hearing from people or organisations that would like us to customise Cycle Hire Widget for their particular domain, whether it's cycles with availability in another city, coffee shops with opening hours in a geographic region, or dieting group meetings at pertinent times nearby. You name it, there are a gazillion applications for it!"

Well here on the App Engine team, we're happy for Kenton and his team on being able to implement the server-side solution they needed in such a short period of time on App Engine, and better yet, to help out a worthy cause. Google itself is a socially responsible company that applauds efforts like Barclays Cycle Hire, so we're proud that technologies we provide such as Android and App Engine can be used to help make London and the Earth more sustainable!

Posted by Kenton Price & Reuben Harris, Little Fluffy Toys Ltd, and Wesley Chun, App Engine team


Tom Gullo said...

Inspiring story.

I've been studying transactions, tasks and other complex concepts of AppEngine in preparation for my first real app. Now I think I need to study less and do more.

Jim Ramia said...

Great Work!

Alt-S said...

It's nice to use GAE with simple project and simple structures. But if you are going to use reference properties in DB etc. then you will soon find yourself scratching your head because with every 100 additional records your query will grow 1 sec.. until you reach your 30 sec deadline and you are doomed.

My point is that GAE team should educate us better how NOT to think like Relational-DB guys. Otherwise there will be only toy project success stories.

Rajkumar said...

@alts: Agree. It is initially hard to get to terms with the guidelines, when coming from relational-db background to Google App Engine.

I work on a tool which intends to make it easy to have a database app running over GAE, without having to worry about the back-end issues.

One can build customizable database apps online using iFreeTools Creator, without having to worry finer details.

Check out this walk-through on building database apps online :
Build Apps Online, over Google App Engine, using iFreeTools Creator

Unknown said...
This comment has been removed by the author.
Unknown said...

We have also developed a GPS App for iPhone/Android with 100% Google Technologies (

Technical Info:
- Back-end using Google AppEngine cloud infrastructure
- Front-end using Google Web Toolkit which can run on both iPhone Safari and Android Chrome (also other desktop browsers)
- GWT based internationalization
- Integrated with Facebook Connect for wall posting
- Using Google Maps API for reverse geocoding (retrieve your address automatically when you add a new location)
- HTML5 based Geolocation for tracking your location with GPS
- HTML5 based Web Database for storing local information in the browser

- Discover interesting locations around you with beautiful photos
- Share your journey with friends by checking-in to locations around you
- Grabbing mayorship of a location when you checkin frequently
- Post to Facebook wall when you checkin
- Locate where your friends have been to
- Add new locations with photos
- A ranking showing the top travelers with the highest number of mayorships
- Support English, Traditional Chinese and Simplified Chinese

You may try it here:

The app can also be found in Google App Engine Applications Gallery

Nic Wise said...

Hi there

I've done a similar thing for my iPhone app London Bike App ( OK, so it's not all google (MonoTouch for the iPhone part, Python App Engine for the backend).

I found GAE to be lovely to develop in. I've done a small app about 18 months ago, but other than that I've dont done any python at all.

Performance, so far, is great. I need to check the docs on the best way to update a load of records in one go (it's taking about 20 seconds for 350 rows), but other than that....

Thanks for GAE - loving using it.