Facebook Platform Versus Google OpenSocial

Nobody likes a one-sided race: our competitive spirits take a beating at the unfairness of it all. Just when it looked like Facebook was going to single-handedly make a break for the cookie jar and steal all the cookies, competition popped up in the form of the OpenSocial Application Programming Interface (API). It’s important to take a moment to understand what that means to you, the would-be Facebook developer, so that you can feel secure in your decision to write apps for this Platform.

What Exactly Is OpenSocial?

With much fanfare, Google, along with a community of websites and developers, launched OpenSocial on November 1, 2007. Now that you have the gist of Facebook Platform, think about how much more powerful it would be if your Facebook apps could run inside lots of other websites too. The promise of OpenSocial is that you can build an app that runs on an ever growing list of sites including, MySpace, My Yahoo!, iGoogle, Friendster, h5, orkut, and others with little to no modification, giving you a potential audience of 600 million users (or three times the size of Facebook, though it should be noted that installation on one of those doesn’t guarantee or even cross-promote installation on others, and so the network effect of the social graph is tempered). Unlike Facebook Platform, you don’t need to learn a proprietary markup language. The OpenSocial API includes three major areas of functionality, accessible through both JavaScript and via data APIs:

People

Information about individual people and their relationships to each other

Activities

Ability to post and view updates on what people are doing

Persistence

A simple key-value data store to allow server-free stateful applications

That definition obviously leaves a great deal out, and it’s never wise to discount a specification backed by companies with more Ph.D.s per square foot than a NASCAR track has beer-drinking race fans. OpenSocial will evolve pretty quickly and is already beyond the scope of this subsection to describe, so you should take a few minutes to familiarize yourself with the information posted on the OpenSocial website (http://www.opensocial.org). Like many arguments in the tech industry, some of this is going to come down to a religious war (see Mac OS versus Windows, etc.). A fair chunk of the rest is going to come down to the seemingly eternal struggle between Open and Closed, with Google and friends crusading under the Open banner and characterizing Facebook as the dark lord of Closed. There is some truth to that position: OpenSocial apps will run on any website that implements an OpenSocial container, and their environment is built on open technologies such as HTML and JavaScript, whereas Facebook requires developers to learn closed technologies such as Facebook Markup Language (FBML) and Facebook JavaScript (FBJS). The Facebook Legions would argue that Platform is really just extending the same open tech, that learning those extensions is almost trivial (as you’ll soon see), and that their carefully developed and controlled environment means developers and users get more control, greater security, and easier interoperability. This is a theme that runs much deeper than the social network space, and anyone who has been in the industry for more than a few years has seen the same battle play out in any number of fields, from operating systems (Windows versus Linux) to browsers (Internet Explorer versus Firefox), and from content delivery formats (Flash versus HTML) to user interface markup languages (XAML versus XUL). The world of digital music is going through this as well in their classic, Hamlet-like struggle (To DRM or not to DRM: that is the question), and the mobile application space is about to have a similar shakeup with the release of Google Android and its push to open the previously walled gardens.

Who’s Going to Win?

It's still very early days in this battle and it's very hard to predict the outcome. As of the time this book was written, there are over 20 sites with OpenSocial sandboxes or application containers enabled, including Orkut, hi5, Ning, and Plaxo, giving some of their users the ability to try OpenSocial apps in the context of their sites. Anecdotal evidence from leading app developers like Slide, RockYou, and iLike says that porting apps from Facebook Platform to OpenSocial is relatively trivial, and suggests that you can easily start with one and move to the other. Historical precedent suggests that some open platforms have a lot of success (Firefox has stolen a big share of the market away from Internet Explorer), while a number of closed systems have done even better (Apple's complete domination of the MP3 market is based largely on iTunes and iPods being completely closed).

Ultimately, the announcement of OpenSocial is a win for developers just like you, because it signifies a maturing marketplace backed by serious investment from major industry players. Marc Andreessen, founder of Netscape and now of OpenSocial partner Ning, agrees: “As an app developer, there’s no real reason to choose between Facebook and OpenSocial. It’s easy to do both. You’ve already put in most of the effort—creating a new set of frontend HTML and JavaScript pages is almost trivial, and that’s all you need to do to have your app ‘port’ to OpenSocial....”[4] Mark’s proposed strategy (which is a very solid one) is to maintain a single backend with four sets of frontend pages, each optimized for different platforms:

  • A set in normal HTML/JavaScript for consumption in regular browsers

  • A set in FBML and FBJS for use in Facebook

  • A set in normal HTML and using JavaScript to connect to the OpenSocial API for use in OpenSocial

  • A possible fourth set adapted for use on mobile devices, such as Apple’s iPhone

What Should I Do?

Calling Facebook Platform “mature” seems odd given how young it is, but it will always be nine months older than OpenSocial. Since the number of people who can access OpenSocial containers is currently smaller than the number of Facebook users, as of September 2008, and since Facebook’s social graph will make it easier for your application to pick up a larger user base in less time, you should start by building a Facebook version—but make sure to architect your backend services so that they are loosely joined to the frontend and can be used easily by an OpenSocial version later (we’ll cover this in detail in Chapter 4).

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.