A Whole Bunch Of Crazy Delivered Across The Internet.
Delivered By A Crazy Maniac.

I Hate you Google

Oh Google, why oh why did you have to create OpenSocial? Yes it was noble of you to try and connect all the different social networks - but the way you did it is incredibly prohibitive to most developers.

As a MySpace user, with many of my friends MySpace users, I was looking forward to the launch of the MySpace Developer Platform

When it finally did open, I was sadly disappointed to find out that they had decided to leverage Google’s OpenSocial Developer. Why? Simply because I don’t do JavaScript.

When the Facebook API came out it was great because you can use it with any programming language you want; PHP, Java, Ruby, Python; any language that can handle REST and output some code.

Let me give you an example, here is the OpenSocial code for getting a list of the users friends (copied from Google):

 <script type="text/javascript">

 /**
   * Request for friend information when the page loads.
  */
  function getData() {
    document.getElementById('message').innerHTML = 'Requesting friends...';
    var req = opensocial.newDataRequest();
    req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
    req.add(req.newFetchPeopleRequest ('VIEWER_FRIENDS'), 'viewerFriends');
    req.send(onLoadFriends);
  };

 /**
   * Parses the response to the friend information request and generates
  * html to list the friends along with their display name.
  *
  * @param {Object} dataResponse Friend information that was requested.
  */
  function onLoadFriends(dataResponse) {
    var viewer = dataResponse.get('viewer').getData();
    var html = 'Friends of ' + viewer.getDisplayName(); 
    html += ':<br><ul>';
    var viewerFriends = dataResponse.get('viewerFriends').getData();
    viewerFriends.each(function(person) {
      html += '<li>' + person.getDisplayName() + '</li>';
    });
    html += '</ul>';
    document.getElementById('message').innerHTML = html;
  };
  gadgets.util.registerOnLoadHandler(getData);

      </script>
      <div id="message"> </div>

Now here’s the same facebook code in PHP


$facebook = new Facebook($api_key, $secret)
$friends = $facebook->friends_get()

foreach($friends as $f) {
$user = $facebook->user_getInfo($f, array('first_name', 'last_name');
print $user[0]['first_name'] . $user[0]['last_name'] . '
'; } ?>

And remember again, that the OpenSocial code is executed client side, so if I wanted to use any of the user’s data server-side (i.e with a database) one would have to try and use some kind of AJAX commands to try and get the data into a database.

Although, I’m not being entirely pessimistic here, I’m hoping that something comes down the line that lets me code for MySpace without JavaScript

7 Feb 2008 (7 months ago) Comments (View)
blog comments powered by Disqus
© me 2008. • icons • feed
Join my blog network
on Facebook
Blog Networks