February 16, 2009

fetchPersonAppData data structure

opensocial javascript API's fetchPersonAppData returns an object with the following structure:
- person_id
   - [key, value]
   - [key, value]
- person_id
   - [key, value]
   - [key, value]

This structure retain the maximum flexibility so that it can return multiple person and multiple key at the same time. However, it can easily confuse first-time users of our library if we return the raw data. We are thinking whether we should return a more structured data back to the caller.

Structure:


AppData
   - PersonData
     - DataElement
     - DataElement
   - PersonData
     - DataElement
     - DataElement


AppData.getPersonDatas() returns an Array of PersonData object. Each PersonData contains an array of DataElement. Each DataElement is a [key, value] pair.


Advantage of returning a structured data
It will be easier for the user of our library to decipher the data. Flex Builder's code-helper will be useful in this case. Without refering back at the javascript documentation, user can still figure out the data structure of the data being returned.

Disadvantage
It will be a departure from the javascript API.


If you have strong feeling about going one way or the other, please let us know.

No comments:

Post a Comment