Flapjax Simplifies AJAX Development

The new JavaScript-based language for AJAX development "pancakes" other AJAX development schemes by hiding complexity, its creators said.

Researchers at Brown University have created a new programming language for developing Web applications, known as Flapjax.

Flapjax is a new twist on AJAX (Asynchronous JavaScript and XML) style development that is based on JavaScript, said Shriram Krishnamurthi, a computer science professor at Brown who is leading the project.

The new language makes AJAX-style development easier by hiding complexity, its developers say.

Krishnamurthi, based on Browns Providence, R.I., campus, said Flapjax is easy to learn for many developers because "its syntax is precisely that of JavaScript."

Furthermore, "because Flapjax is built entirely atop JavaScript, it runs on traditional Web browsers without the need for plug-ins or other downloads," he said.

"In fact, you can (in exchange for a little more code) use Flapjax purely as a library in JavaScript rather than use the compiler from Flapjax to JavaScript, so you can integrate it into your existing programs."

Moreover, Krishnamurthi said Flapjax has six primary characteristics: It is event-driven and reactive; it reduces unnecessary code through its template system; it provides a persistent store that automatically updates all clients sharing the same data; it enables sharing of data with others; it implements access control to channel the data sharing; and it libraries to connect to external Web sites, which enables the creation of client-side mashups.

Krishnamurthi and the core team of Flapjax developers released the technology under the BSD open-source license.

The Flapjax Team, which has copyrighted the name, includes Krishnamurthi, Leo Meyerovich, Michael Greenberg, Gregory Cooper, and Aleks Bromfield.

Krishnamurthi gave a preview of Flapjax at the Lang.NET Symposium at Microsofts campus in Redmond, Wash., on Aug. 1.

There he demonstrated Flapjax in action to an audience of language gurus.

/zimages/4/28571.gifClick here to read more about the Lang.NET 2006 Symposium on the Microsoft campus.

"What we do is present a language that hides the messy details of AJAX," Krishnamurthi said.

"Instead of worrying about building low-level packets, etc., we give you a simple way of saying This datum resides on a remote server—send all of my updates to it, and get all updates from it to me. Thats what AJAX is typically used for, but never at that high level of abstraction."

Developers can look at Flapjax in one of two ways, Krishnamurthi said.

The technology can be adopted as a new language that shares the syntax of JavaScript but makes it more natural to write interactive applications, he said.

Or some developers might just use Flapjax as a JavaScript library that offers some help in making interactive applications, he said.

"So, even a person who doesnt want to use the Flapjax-to-JavaScript compiler can still use the features of JavaScript—they would just need to write more code by hand," Krishnamurthi said.

Dion Almaer, the Madison, Wis.-based co-founder of Ajaxian.com, said he thinks Flapjax is "really interesting technology," but he does not expect it to take the world by storm.

"It is a big step to add in a compilation piece," Almaer said. JavaScripters are used to just throwing up code that runs in the browser," he added.

However, "It could help if [Flapjax] teamed up with a framework like, for example, [Ruby on] Rails," Almaer said.

"That would allow you to put up Rails helpers that produce compiled Flapjax."

The Flapjax tutorial on the technologys Web site says Flapjax tries to reconcile two programming styles that have been in conflict: declarative and imperative programming.

Imperative programming makes the developer act as bookkeeper of the code and to specify which algorithms are to run in program, whereas declarative programs explicitly specify the goal of the program and leave the implementation of the algorithm to the support software.

Yet, in contrast to both of these, "Flapjax programs tend to be declarative specifications over imperative data," the tutorial said.

Although Flapjax is touted as simplifying AJAX development, some developers viewed it as possibly adding complexity.

In a response to a blog post on Flapjax on the Ajaxian site, a developer who identified himself as Ryan Gahl called it "a step backward. Instead of separation of concerns, it encourages spaghetti. Spaghetti is good for dinner with meatballs and a little parmesan. Keep it away from my projects."

However, Krishnamurthi responded that Flapjax is usable in many ways, and in its "unobtrusive" mode, Flapjax separates the applications presentation layer from its markup.

The unobtrusive mode provides functionality similar to that of aspect-oriented programming, he said.

/zimages/4/28571.gifCheck out eWEEK.coms for the latest news, reviews and analysis in programming environments and developer tools.