Facebook plateform architecture presentation


Published on

Published in: Education, Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Facebook plateform architecture presentation

  1. 1. Olgun Cakabey Inam Soomro April 2011 PLATFORM ARCHITECTURE
  2. 2. <ul><li>Face b ook at a Glance </li></ul><ul><li>General Design Principles </li></ul><ul><li>Facebook Platform </li></ul><ul><li>Architecture Overview </li></ul><ul><li>XML Webservice </li></ul><ul><li>WebService Authentication Handshake </li></ul><ul><li>FQL </li></ul><ul><li>Applications on Facebook </li></ul><ul><li>FBML </li></ul><ul><li>FBJS </li></ul><ul><li>What We’ve Learned Today/Conclusions </li></ul>Agenda
  3. 3. <ul><ul><li>“ 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.” </li></ul></ul><ul><ul><li>-Fred Brooks, The Mythical Man-Month </li></ul></ul>
  4. 4. Facebook Platform
  5. 5. Face b ook at a Glance <ul><li>THE SOCIAL GRAPH </li></ul><ul><li>Facebook Platform launched in May 24, 2007 </li></ul><ul><li>More than one million developers and entrepreneurs from more than 180 countries </li></ul><ul><li>More than 550,000 active applications currently on Facebook Platform </li></ul><ul><li>Every month, more than 70% of Facebook users engage with Platform applications </li></ul><ul><li>More than 250,000 websites have integrated with Facebook Platform </li></ul><ul><li>More than 100 million Facebook users engage with Facebook on external websites every month </li></ul>* http://www.facebook.com/press/info.php?statistics
  6. 6. General Design Principles <ul><li>Open Source </li></ul><ul><li>Unix Philosophy </li></ul><ul><ul><li>Keep individual component simple yet performant </li></ul></ul><ul><ul><li>Concentrate on clean interface point </li></ul></ul><ul><li>Build everything for a scale </li></ul><ul><li>Try to minimize failure points </li></ul><ul><li>Simplicity, simplicity and simplicity… </li></ul>
  7. 7. Facebook Application Architecture <ul><li>Under the covers </li></ul><ul><ul><li>Get Profile data </li></ul></ul><ul><ul><li>Get Friend connections </li></ul></ul><ul><ul><li>In Parallel fetch photos </li></ul></ul><ul><ul><li>Execute rendering logic in PHP </li></ul></ul><ul><ul><li>Return Data and make users happy </li></ul></ul>
  8. 8. Facebook Platform <ul><li>Facebook developer defines Facebook Platform as: </li></ul><ul><li>“ A standard based web service with methods for accessing and contributing Facebook data.” </li></ul><ul><li>It offers reliable and consistent methods to exchange ınformatıon between itself and thırd parties. </li></ul><ul><li>Handle relationship between the facebook users. </li></ul><ul><li>Offers methods of interactions between users </li></ul>
  9. 9. Facebook Platform <ul><li>What comes with Facebook Platform </li></ul><ul><ul><li>Facebook Platform Application Programming Interface (Facebook API) </li></ul></ul><ul><ul><li>A query language - Facebook Query Language (FQL) </li></ul></ul><ul><ul><li>A data-driven markup language – Facebook Markup Language (FBML) </li></ul></ul><ul><ul><li>Facebook JavaScript (FBJS) </li></ul></ul>
  10. 10. FB API <ul><li>FB API Provides a range of API methods for its application developers. </li></ul><ul><li>Some API methods </li></ul>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
  11. 11. FQL <ul><li>A way to query Facebook Data </li></ul><ul><li>Same syntax as Standard SQL </li></ul><ul><li>Advantages of FQL </li></ul><ul><ul><li>More Efficient </li></ul></ul><ul><ul><li>Can reduce the number of requests </li></ul></ul><ul><ul><li>Language Independant </li></ul></ul><ul><ul><li>FQL syntax: </li></ul></ul><ul><ul><li>SELECT [fields] FROM [table] WHERE [condition] </li></ul></ul><ul><ul><li>Example: </li></ul></ul><ul><ul><li>SELECT Name, Pic, FROM users WHERE uid = 1234 </li></ul></ul>
  12. 12. FB Data as a Social Web Service <ul><li>FB data can be accessed through an externally accessible web service </li></ul><ul><li>Application stack consumes the Facebook data as webservice </li></ul>
  13. 13. Web Service Authentication Handshake
  14. 14. Thrift: <ul><li>Enable Transparent interaction between </li></ul><ul><ul><ul><ul><ul><li> and some others too… </li></ul></ul></ul></ul></ul>Open Source Cross-Language inter process communication
  15. 15. Thrift <ul><li>Lightweight software framework for cross-language development </li></ul><ul><li>S tatically generate code </li></ul><ul><li>Supported bindings: C++, PHP, Python, Java, Ruby, Erlang, Perl, Haskell. </li></ul><ul><li>Employing a beautiful tool like Thrift provides: </li></ul><ul><ul><li>Automatic type synchronization </li></ul></ul><ul><ul><li>Automatic binding generation </li></ul></ul><ul><ul><li>Automatic documentation </li></ul></ul><ul><ul><li>Cross-language synchronization </li></ul></ul>
  16. 16. Applications on Facebook <ul><li>Directly rendering HTML, CSS, and JS </li></ul><ul><li>iFrames </li></ul><ul><li>FBML as data-driven execution markup </li></ul>
  17. 17. Directly rendering HTML, CSS, and JS <ul><li>Using just two new fields names: </li></ul><ul><li>application_name and callback_url </li></ul><ul><li>For example: </li></ul><ul><li>application_name = tartuuniversity </li></ul><ul><li>callback_url = http://ut.ee/fbapp/ </li></ul><ul><li>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 </li></ul>
  18. 18. iFrames <ul><li>http://apps.facebook.com/tartuuniversity/PATH?QUERY_STRING results in HTML output like this: </li></ul><ul><li><iframe src=“ http://ut.ee/fbapp/PATH?GET_STRING ”></iframe> </li></ul>
  19. 19. FBML <ul><li>Acronym for Facebook Markup Language </li></ul><ul><li>Variant-evolved subset of HTML </li></ul><ul><ul><li>br, div, li, span, etc. </li></ul></ul><ul><li>Facebook specific tags </li></ul><ul><ul><li>fb:create-button, fb:dashboard, fb:error, fb:message, etc. </li></ul></ul><ul><li>An instantiation of XML therefore it consists of tags, attributes and content. </li></ul>
  20. 20. FBML <ul><li>These tags fall into some conceptual categories: </li></ul><ul><ul><li>Direct HTML tags </li></ul></ul><ul><ul><ul><li>Exact HTML tags no difference with original ones </li></ul></ul></ul><ul><ul><li>Data-display tags </li></ul></ul><ul><ul><ul><li><fb:profile-pic uid=“8055”> </li></ul></ul></ul><ul><ul><li>Data-execution tags </li></ul></ul><ul><ul><ul><li><fb:-if-can-see> </li></ul></ul></ul><ul><ul><li>Design-only tags </li></ul></ul><ul><ul><ul><li>Look&Feel, <fb:tabs> </li></ul></ul></ul><ul><ul><li>Replacement HTML tags </li></ul></ul><ul><ul><ul><li>For modifying or restricting a certain set of parameters; <fb:flv> </li></ul></ul></ul><ul><ul><li>Functionality package tags </li></ul></ul><ul><ul><ul><li><fb:friend-selector> </li></ul></ul></ul>
  21. 21. FBML
  22. 22. FBML vs. iFrame 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
  23. 23. <ul><li>function foo(bar) { </li></ul><ul><li>var obj = {property: bar}; </li></ul><ul><li>return obj.property; </li></ul><ul><li>} </li></ul><ul><li>becomes </li></ul><ul><li>function a12345_ foo( a12345_ bar) { </li></ul><ul><li>var a12345_ obj = {property: a12345_ bar}; </li></ul><ul><li>return a12345_ obj.property; </li></ul><ul><li>} </li></ul>FBJS
  24. 24. What We’ve Learned Today/Conclusions <ul><li>FBML plays important role in building applications until.. </li></ul><ul><ul><li>* 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. </li></ul></ul>* http://developers.facebook.com/roadmap/
  25. 25. <ul><li>THANK YOU </li></ul><ul><li>ANY QUESTIONS? </li></ul>