Archive

Show case ajax aplication: beebole.com

I have ran across beebole.com time management ajax app, and peeking under the hood a little with firebug, I have discovered a nice server/client interaction pattern, that beebole.com uses: the way the app talks to the server, is through ajax posts to the same url with single key (data) where they pack a "stringified" JSON, which contains all the data, methods, keys. The main advantage I see in this approach is that, you can really mainstream your code both on the client and on the server.

For example, here is one such JSON that was send to the server as a result of clicking "collapse" on one of the widgets:

{
    "service": "user.update_doc",
    "etype": "user",
    "eid": 1,
    "uKey": "doc.app.screens.wgroups",
    "doc": {
        "home": [{
            "s": [25, 40, 35]
        },
        [{
            "name": "addCompany",
            "cl": true
        },
        {
            "name": "lastUsed",
            "cl": true
        }], {
            "name": "timeSheet",
            "calId": "wcal"
        },
        {
            "name": "googleVisualization",
            "groupBy": "drill",
            "chartType": "pieChart",
            "period": {
                "k": "w"
            }
        }]
    },
    "applyAll": true,
    "wid": false,
    "session": "110342d05fa560257af4d7030c98db83c2291d81"
}

Now these guys obviously live JSON, since the same company is responsible for pure templatign JavaScript library, so if JSON is your thing, this is the way to go. For some reason, I still have problem letting some templating code generate my layouts. I feel that it might be slow or inflexible, but this approach is starting to appearing in other libraries (EXTJS), so maybe HTML coding as we know it might be dead in rich internet applications (RIA). As for my ideal approach, I still feel that baking the HTML markup on the server might save a few of milliseconds in rendering, and that the server has more power and tools, to create structured presentation code.

Comments: