Facebook made a splash a year or two ago when they opened up their API. Now developers could write applications that integrate with the site. Instantly, users — many of whom had fled to Facebook from a spam-filled MySpace — were inundated with Requests to battle ninjas and News Items bearing obscene pictures. To Facebook’s credit, they did clamp down and put some restrictions on what apps can do. A few entertaining or useful applications have risen to the top, and the potential of the API is ready to be exploited. It’s not an easy task for a developer, however.
In the next few Chicken Scratches posts, I’ll talk about my experience developing two Facebook apps from scratch: The Limerick Book, a site that works both in and outside of Facebook and allows users to share and rate Limericks, and Play Scopa, a traditional Italian card game that users can play against each other in realtime (this one is not yet launched to the public).
This first post discusses some of the difficulties I have run into. In the next couple posts, I’ll discuss how I dealt with them. First, to set the scene:
I am using the Django web framework for my backend development, the latest SVN version running with Python version 2.4 on a shared host at Dreamhost. In fact, it’s the same server I use for this site and weblog. To connect Django to Facebook, I am using the nice PyFacebook library, which is pretty mature, though I had to modify the code to support some of the latest features of the Facebook API.
And now, on to the perils.
Peril 1: Birds of a Feather
Peril 2: Layers of indirection
Debugging can be very difficult. The major added difficulty in debugging a Facebook app is simply that the app has to run on Facebook. In typical web development, you can usually edit and test right on your local machine, or at least on your local network. I have come up with some tricks, which I will document in future posts, to enable as much local testing as possible, but much of your time will be spent debugging interactions between users, between your app and users, and between your app and the Facebook platform. This requires a tedious cycle of edit, upload, test; edit, upload, test; edituploadtest edituploadtestedituploadtest, and so on.
Peril 3: You’re at their mercy
The Facebook API is still pretty new, and Facebook itself is still a young company. There are inevitably going to be growing pains, and in fact, as I write this, Facebook’s backend servers are experiencing some major network issues, causing many apps to not function properly. It can certainly be frustrating not knowing whether something is failing due to a local bug or a problem with the API.
In addition, APIs, policies, and presentation are constantly changing. Can I post a profile message today? Can I send an email? To which users? Better check the rules, because they’ve probably changed. It is of course Facebook’s playground, so it is their right to change the rules as much as they want, and we as developers just have to be ready to deal with that. It’s a fact of life, and it’s another unique challenge of developing a Facebook app.
Peril 4: It’s different
But I’m doing it anyway
Well, what can I say? Developing for Facebook is fun. It’s very visual, and it’s rewarding to share what you’ve created with your online “friends.” Stay tuned for more posts on my development experience, including some of the more technical issues and how I dealt with them, using Python and Django.