Tuesday, May 05, 2009

JSON (JavaScript Object Notation): Name/Value pair

The most frequent software developer environment I use recently is Python and Flex. What I like them most are their flexible "Data Structure". After exploring JSON a little bit, I found all of them have similar style to handle flexible data type.

Since I said I like them (data structure of Flex and Python), it must be something I don't like. It's java's strong type. In Java, if you want to store a complicated data of objects, you will need to create a object and necessary setter and getter for each parameter of object. For example,

public class Student
{
String firstName;
String lastName;

public setFirstname(String firstName)
{
this.firstName = firstName
}

public String getFirstname ()
{
return this.getFirstName

....
....
}
}

In this case, only three attributes, you will need to create at least 3*2 methods; just for passing values. Therefore, programmers sometimes would just store data in local variables instead of creating a object. For the long run, local variables are getting more and less abstraction would increase the difficulty of modifying data structure.

Flex is the Rich Internet Application (RIA) of Adobe. Current released version is 3.0 and 4.0 is for SDK. Flex uses Actionscript 3.0 as it's internal script language (java like syntax). But for better data representation and manipulation (Adobe advocates that advantage), actionscript has it's own special way to store and visualize data, which are "Array collection" and "Data grid". Here I will focus on discussing "Array collection". Surprisingly, I found out these three Array Collection, Python dictionary and JSON are pretty similar. I didn't examine whether they learn experience from each other.

Ironically my current boss are the pioneer of data standard and data exchange, one of his paper already discuss what is the best practice for storing data. I will use his paper to elucidate the philosophy of storing data.

not finished. ...

Labels:

0 Comments:

Post a Comment

<< Home

<