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.








Comments