O'Reilly logo

Programming Social Applications by Jonathan LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data Pipelining

There comes a time in every developer’s career when he realizes that embedding a data source directly into the application markup makes for an application that is not only hard to maintain and debug, but is also not scalable in the long run. Separating out a data source—such as a JSON or XML object obtained from a third-party resource—from the page markup, or visual layout, is key to building applications that are modular, easy to maintain, and highly scalable.

The first part of this process involves the data retrieval methods that make the raw information available to your application, which is where we’ll begin our discussion of data pipelining. Data pipelining allows developers to pull in a data source from some third-party resource and make it available within the gadget code base. The reasoning behind such an implementation is twofold:

  • It provides developers with an easy and scalable method for accessing a raw data source, without them having to embed a mechanism to make and handle the request.

  • The data source can be used in a multitude of ways to build a rich data source/template interaction.

Before data pipelining became available within the OpenSocial specification, developers had to make the request through standard HTTP requests and handle the data source themselves:

<script type="text/javascript"> function requestCallback(response){ var data = response.content; //build data source } //define URL to make GET request to var url = "http://www.mysite.com/dataSource.php"; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required