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"; ...

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.