Saturday, August 25, 2007

Facebook Programming

This month I delved deep into the big, evil mass that has somehow managed to attract so many millions in such a short time. I'm talking of Facebook.


In May this year they launched the Facebook Platform, an API for developers to develop their own applications that could integrate into Facebook. Most of you will better understand me if I simply referred to Facebook applications. Those things that many consider to have damaged Facebook beyond repair. Super Poke anyone?

There's a course on Internet Interoperability offered at UCT and I was contemplating whether or not to take it. When I discovered the assignment would be developing a Facebook application, however, I thought it could be an interesting experience. I don't think I would have investigated it on my own as I'm not all that interested, but since we were being taught on the topic I decided to take the course for fun.

The code for an application is hosted by the developer and Facebook queries the developer's server when the application is accessed by a user. For scalability purposes, the profile box is generated only by the application only when a user takes an action such as configuring th application. The generated FBML (more on that later) is stored by Facebook to provide pseudo-dynamic content that when is already there when a user views the application on a profile.

A developer codes up several pages, such as the installation page, the dashboard and the main application page. Each can interact with Facebook by sending and retrieving data using its REST-based API. The API offers a SQL-like query language called FQL to retrieve specific data, while this is all retrievable by other API calls. The code then outputs FBML (Facebook Markup Language) which is a subset of HTML with some Facebook-specific tags, such as fb:name, which are translated into HTML by Facebook. When code on the developer server is called, the code can set the FBML of the profile box.

There's a lot more to developing an application, but that's the basics. One of the major hassles I found is the numerous small things you had to do to come up with a complete application. There are so many pages, some of which they could easily offer template pages for, such as invitations, installation, etc. The other hassle was the number of round-trips between the application and Facebook servers very easily caused timeouts. Bear in mind the awful latencies between South Africa and the rest of the world!

If you're wondering what application I developed, it's a simple application which gathers publications from OAI feeds. It lets you select and display a list of your publications. It's not polished at all, so I wouldn't call it very useful. I used it myself to just experiment around with Facebook applications. If you really want to check it out, it's available here.

After all that, we also wrote an essay on the interoperability of Facebook. It was a fairly interesting topic, but it was a little restrictive on the content. You can grab mine here. I'd be interested to hear what other Facebook developers think.

6 comments:

  1. I would like to thank you. I have known for a while now that I do not want to do honours in Computer Science, but looking at your essay has reassured me that I am making the right decision by choosing Physics.

    ReplyDelete
  2. How to respond on a public site? Firstly, I haven't done Physics since matric so I really can't compare. That essay was just silly. Yes, you do get other modules which also require silly essays. I dodged them for the most part, but the curiosity of Facebook and Hussein lecturing and knowing I could drop it at any time made me go for it.

    Don't take it as propaganda. Just wanted to clear that up for anyone else that you can dodge the crap. I've done it fairly well by taking almost all the modules and dropping the ones that look ugly. Just look at the bottom of this page to see the list I started, but later dropped.

    I must stop this now. It's probably sounding like propaganda, which was not my idea. Go with your gut feeling. That splur above was for others passing by.

    Since such a small effort has convinced you one way, I'm wondering whether I should do this for other modules? Depends on if there's a response here.

    ReplyDelete
  3. Sorry, I did not mean to sound negative. I was really considering doing Computer Science, and did not expect to get hooked on the Physics. I will probably end up with a career in computers anyway, since it looks more appealing than what Physics has to offer. But I personally find studying Physics is much more fun.

    Anyway, what is wrong with propaganda? Convincing people to do honours can't be a bad thing, can it?

    ReplyDelete
  4. Convincing is acceptable when one is completely informed of all decisions. However, I am not well enough informed about Physics to advise you about the decision other than passing on knowledge of my experience with Computer Science.

    This report should give a better insight into the work you cover in CS honours.

    ReplyDelete
  5. Hi,
    Thought I'd chip in.

    Do the physics degree I guess.
    A computer science degree will make you a better practical programmer.

    The thing is,
    you can become a programmer if you have a physics degree.
    But,
    you can't become a physicist with a computer science degree.


    Where do I stand? I did most of a physics degree and applied mathematics, as well as some elec engineering subjects, and doing my honours in computer science now,
    Physics is fun.
    What holds above for a physics degree holds for a E&E engineering degree too. Both similar in the limit.

    That genetic algorithm link you provided looks like some work that's done in a 3rd year applied mathematics course (http://dip.sun.ac.za).

    Good luck!

    ReplyDelete
  6. Hey everyone, I have written a full ebook to teach you how to write facebook applications.

    http://beasleysoftware.webatu.com/index.php

    Here are some take-aways you get:
    1. Covers 20+ functions with step by step instructions.
    2. 3000+ lines of fully working example source code - 24 complete PHP facebook scripts.
    3. Downloadable for offline browsing.
    4. Written for start-up beginners AND seasoned PHP professionals.
    5. Content is updated & appended with new content. You'll own access to knowledge about the latest additions to the facebook API.

    http://beasleysoftware.webatu.com/index.php

    try it out yourself. You'll be glad you did.

    Thousands of developers support themselves with 6 digit incomes in the facebook app industry. See what it can do for you! It's a multi- million dollar industry!

    ReplyDelete