Tuesday, November 4, 2008

Facebook Plugins

Facebook, Inc.Image via WikipediaThere are two Facebook plugins for Ruby on Rails. Both help you deal with the Facebook API.

RFacebook was the first Facebook plugin introduced and is basically a wrapper around the Facebook API enabling you to call it through plugin methods whose names map to the corresponding call in the API. If the API changes, the plugin supports that. You can use Facebook docs to figure out what to do and you can get data in XML or JSON.

RFacebook was intended to be quick and dirty and the author even stated early on that developers should eventually move to Facebook. But many people stuck with it.

Facebooker does things "the Rails Way", and gives you methods that follow Rails conventions. Data is delivered in arrays and hashes Ruby developers are used to working with. In addition, there are classes that help you with publishing to feeds and sending notifications.

With Facebooker, being able to deal with ruby objects saves development time. But you aren't always aware of whats happening under the covers. Sometimes a call to Facebook is initiated when you don't expect and that costs you time. Its an even bigger deal on Rails because your Mongrel can't service any other requests while its waiting for Facebook to respond.

The support for Facebooker has been questionable at times also, since the original auther Chad Fowler left the project. Code has been checked with typos, the entire project was simply moved to github without sufficient notification (even the Facebook app for the plugin pointed to an unusable SVN version for weeks) and some of code was baffling to use. The template registration stuff, for example, took me some major digging through the code to figure out what to do and it didn't even work.

Of course, some of these issues are due to Facebook changing so frequently, but at least with RFacebook, you're rely upon Facebook documentation rather than on the ability of Rails developers to code against each version of the API. Either way its still a moving target sometimes.

Facebooker does give you some help with REST, but even that took me quite a while to figure out how to use that successfully. I do use Facebooker for my grokLokker Facebook app and its stable enough for what I'm doing. But I doubt I'd use it if I had t to due over.
Reblog this post [with Zemanta]

No comments: