Facebook plateform architecture presentation

Post on 17-May-2015

5.332 views 0 download

Tags:

Transcript of Facebook plateform architecture presentation

Bilgisayar Mühendisliği Bölümü

UT – Software Engineering

Olgun Cakabey

Inam Soomro

April 2011

PLATFORM ARCHITECTURE

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software 2

• Facebook at a Glance• General Design Principles• Facebook Platform• Architecture Overview• XML Webservice• WebService Authentication Handshake• FQL• Applications on Facebook• FBML• FBJS• What We’ve Learned Today/Conclusions

Agenda

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

“Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t

usually need your flowcharts; they’ll be obvious.”

-Fred Brooks, The Mythical Man-Month

3

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Facebook Platform

4

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Facebook at a GlanceTHE SOCIAL GRAPH

• Facebook Platform launched in May 24, 2007

• More than one million developers and entrepreneurs from more than 180 countries

• More than 550,000 active applications currently on Facebook Platform

• Every month, more than 70% of Facebook users engage with Platform applications

• More than 250,000 websites have integrated with Facebook Platform

• More than 100 million Facebook users engage with Facebook on external websites every month

5

* http://www.facebook.com/press/info.php?statistics

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

General Design Principles• Open Source

• Unix Philosophy– Keep individual component simple yet performant– Concentrate on clean interface point

• Build everything for a scale

• Try to minimize failure points

• Simplicity, simplicity and simplicity…

6

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Facebook Application Architecture

• Under the covers– Get Profile data– Get Friend connections– In Parallel fetch photos– Execute rendering logic in PHP– Return Data and make users happy

7

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Facebook Platform• Facebook developer defines Facebook Platform as:

“A standard based web service with methods for accessing and contributing Facebook data.”

• It offers reliable and consistent methods to exchange ınformatıon between itself and thırd parties.

• Handle relationship between the facebook users.• Offers methods of interactions between users

8

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Facebook Platform• What comes with Facebook Platform

– Facebook Platform Application Programming Interface (Facebook API)

– A query language - Facebook Query Language (FQL)

– A data-driven markup language – Facebook Markup Language (FBML)

– Facebook JavaScript (FBJS)

9

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FB API• FB API Provides a range of API methods for

its application developers.

• Some API methods

10

Method Description

Friends.getList Returns the identifier for the current user’s Facebook Friends List

Pages.isFan Check whether a user is a fan of specified page

Photos.addTag Adds a tag along with given information on to the photo

Users.setStatus Updates a user’s Facebook Status

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FQL• A way to query Facebook Data

• Same syntax as Standard SQL

• Advantages of FQL– More Efficient– Can reduce the number of requests– Language Independant

FQL syntax:SELECT [fields] FROM [table] WHERE [condition]

Example:SELECT Name, Pic, FROM users WHERE uid = 1234

11

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FB Data as a Social Web Service• FB data can be accessed through an externally

accessible web service

• Application stack consumes the Facebook data as webservice

12

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Web Service Authentication Handshake

13

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Thrift:

14

• Enable Transparent interaction between

and some others too…

Open Source Cross-Language inter process communication

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Thrift• Lightweight software framework for cross-

language development

• Statically generate code

• Supported bindings: C++, PHP, Python, Java, Ruby, Erlang, Perl, Haskell.

• Employing a beautiful tool like Thrift provides:– Automatic type synchronization– Automatic binding generation– Automatic documentation– Cross-language synchronization

15

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Applications on Facebook

• Directly rendering HTML, CSS, and JS

• iFrames

• FBML as data-driven execution markup

16

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

Directly rendering HTML, CSS, and JS

• Using just two new fields names:

application_name and callback_url

• For example:

application_name = tartuuniversity

callback_url = http://ut.ee/fbapp/

• http://ut.ee declares that it will service user requests to url like http://apps.facebook.com/tartuuniversity/PATH?QUERY_STRING on its own servers, at http://ut.ee/fbapp/PATH?QUERY_STRING

17

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

iFrames

• http://apps.facebook.com/tartuuniversity/PATH?QUERY_STRING results in HTML output like this:

<iframe src=“http://ut.ee/fbapp/PATH?GET_STRING”></iframe>

18

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FBML• Acronym for Facebook Markup

Language

• Variant-evolved subset of HTML– br, div, li, span, etc.

• Facebook specific tags– fb:create-button, fb:dashboard,

fb:error, fb:message, etc.

• An instantiation of XML therefore it consists of tags, attributes and content.

19

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FBML• These tags fall into some conceptual categories:

– Direct HTML tags• Exact HTML tags no difference with original ones

– Data-display tags• <fb:profile-pic uid=“8055”>

– Data-execution tags• <fb:-if-can-see>

– Design-only tags• Look&Feel, <fb:tabs>

– Replacement HTML tags• For modifying or restricting a certain set of parameters; <fb:flv>

– Functionality package tags• <fb:friend-selector>

20

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FBML

21

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

FBML vs. iFrame

22

FBML iFrame

Has a consistent look and feel Enables existing apps to get up and running quicker

Uses FBML elements Makes it easier to maintain a common code base

May offer improved performance

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

function foo(bar) {

var obj = {property: bar};

return obj.property;

}

becomes

function a12345_foo(a12345_bar) {

var a12345_obj = {property: a12345_bar};

return a12345_obj.property;

}

23

FBJS

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

What We’ve Learned Today/Conclusions

• FBML plays important role in building applications until..– *By the end of 2010, Facebook will no longer be accepting new FBML

applications, but will continue to support existing FBML tabs and applications. Facebook recommends the use of iframes for new application development.

24

* http://developers.facebook.com/roadmap/

UT – Software Engineering MTAT.03.240 Seminar on Enterprise Software

THANK YOU

ANY QUESTIONS?

25