Via cafeconleche; Kurt Kagle on AJAX,

In an AJAX application, you explicitly sit on the page load tag to grab an XML (or related) resource from the server, creating an asynchronous call that will update an explicitly defined model, then write more code that will walk through that XML model and either pass it to an XSLT transformation or run it through more DOM manipulation code in order to explicily populate the fields in question in the web page (any more explicit and it would require an X rating).

You can cut this code down considerably with some carefully coded libraries, but these libraries add to the overhead of both loading and maintaining the page, sometimes significantly, and if they are not well written can also add a considerable burden to the debugging department.

He then goes on to argue for XForms. Alternatively you just use JSON and your own javascript framework with a View component to manipulate the DOM directly. The XML in AJAX is fraught with null blowups if you dont get what you want, JSON, as javascript object notation, is far more robust.

Null blow ups are the curse of compiler level issues being propagated up to the business layer. There is no reason why a null should ever be seen at the presentation or business layers. By definition nulls are a stack level issue. It is laziness that they end up as top level exceptions or errors.

The dot com I moved to Phoenix for has their own MVC architecture in javascript. It is a pretty complex and powerful system which leverages much of the power and frustrations of javascript to its advantage.

Javascript is a peculiar technology. Its greatest frustrations are also its greatest power. For instance scoping being only global and function level rather than block level effectively defines its power. Any variable can quickly become an object literal or map which becomes a very powerful data construct and data manipulation mechanism.

XML though, it is a dead-end in that technology. Self defining constructs and schemas have their place, and I have used them in the past where the schema is volatile and needs to define itself at runtime, however AJAX by definition interacts with static services. These are usually done in compiled languages such as Java. In this environment JSON is far more useful and less fraught with errors.

XForms may matter, but I am not seeing it. What I am seeing is javascript becoming the most important business language for the next decade. I am working in applications where the complexity and importance of the javascript code is overtaking the middleware and backend.
Cam Riley: South Sea Republic. Freedom, liberty, equity and an Australian Republic.

Comments

  • adam . # . 2/2
    Javascript is a platform of convenience, I suspect the relative importance you're flagging is a matter of having to deal with UI frameworks being built in parallel with working business apps. This hasn't happened for quite some time and so the availability of JS as a platform makes its demands.

    I suspect there would have to be a new generation of organising abstraction for all that UI stuff, which lets the CPU optimise properly etc. There are already problems with naive web 2.0 code slowing down a website due to client side CPU-boundedness ... at any rate I don't think the server is dead quite yet. It might be niching for a little while.
    Give me utilitiy or give me something slightly better!
    • On the other hand, naive code slows down apps no matter where it is located.
      • adam . # .
        True enough, but I think of it as a leading indicator.
        Give me utilitiy or give me something slightly better!
    • cam . # . 1/1
      The presentation layer keeps reaching deeper and deeper. The front-end developers (which are like gold on this side of the US) have to know HTML/JSP, CSS, Javascript and Java. The middleware folks only have to know java.

      There are appearing frameworks to abstract the complexity out at the javascript UE/UI/App level already. It is like Java in 1999, they are pretty juvenile. The dot.com I am with has their own framework atm. I expect they will comoditise and a few opensource winners will appear - like they did with the java frameworks.
      'Sworn to no party, and of no sect am I.' Frederick Vosper's republican motto.