Friday May 12, 2006
Announcing jMaki: Interview with Greg Murray and Ludo Champenois
In this interview, I talk with Greg Murray and Ludo Champenois, who have been working on a framework to formalize and simplify working with AJAX. Greg created the framework and Ludo is creating a module that integrates it in NetBeans IDE 5.5.
Geertjan: Greg and Ludo, please tell us who you are and what you do.
Greg:
I am the Servlet specification lead and I've been involved with the Java Enterprise Edition web tier since the creation of the platform. I started a grass roots effort at Sun promoting the use of AJAX with Java technologies. I now work for the Java BluePrints and other teams at Sun on developing the best practices for enterprise AJAX and looking for ways to better integrate the Java and AJAX worlds. My blog can be found here.
Ludo:
My name is Ludovic Champenois, also known as Ludo. Just like Greg, I work for Sun Microsystems on the Santa Clara campus. In fact, my office is a few doors down from his. I've worked for Sun for 10 years, first in the Tools group and currently as a senior architect on the Glassfish project. You can find my blog here.
Geertjan: Ludo, recently you seem to have been working very quietly and secretively on something. What's been going on?
Ludo: Well, I've been working on two plugins that expose new frameworks to NetBeans IDE.
The first is the BluePrints Component Library, which has been available on the BluePrints website for a few weeks now. It is a bunch of JSF components wrapping AJAX technology, such as Google map and auto completion. For the NetBeans plugin, these components are made available via extensions to the Library Manager, Frameworks panel, and Component Palette. When the user creates a web application, the Frameworks panel is used in the same way as for JSF or Struts: a new "BluePrints Component Library" item is available which, when you select it, registers JARs on the application's classpath so that their tag definitions can be used in JSP pages. When a JSP file is open in the Source Editor, the Component Palette includes new items for dragging BluePrints components, which use AJAX technology, into a JSP file. This will all be part of NetBeans IDE 5.5 as part of the updated version of the Blueprints Solutions Catalog for Java EE 5.
The second plugin is very similar, in terms of NetBeans integration, which means that it is listed as a new framework in the Frameworks panel, provides new items in the Component Palette, and, possibly, will make some file wizards and project sample available. The plugin exposes the new jMaki framework to NetBeans IDE. There's now also the official jMaki site on java.net. However, note that the NetBeans module for the jMaki framework is not quite ready yet. To give you an idea of part of how it will be exposed in NetBeans IDE 5.5, take a look at the new jMaki section that I am creating in the Component Palette:
Geertjan: So when will you be done with this NetBeans module?
Ludo: During JavaOne!
Geertjan: Partly I'm thinking "Aaaargh! Not another jSomething!" So, what is this "jMaki" animal, Ludo, and what will it do for me?
Ludo: Well, I'm not an expert on jMaki, you should ask Greg, who is its creator, for details. I only started using jMaki three days ago, just so that I could expose it to NetBeans IDE! The point is, basically, that usually AJAX technology is quite hard to use for a developer. AJAX involves JSP knowledge, JavaScript knowledge, and HTML knowledge. And there is no formalized way of working with these technologies in the context of AJAX. What jMaki does is formalize the use of AJAX. So, instead of, for example, putting the JavaScript in your JSP page, jMaki requires you to put it in its own separate JavaScript file. You could compare the concept to the managed bean in the JSF framework: there you have a JSP page delegating business logic to a managed bean. In jMaki, the developer has a specific number of subcomponents: a JSP tag, which is what the developer sees and works with most of the time, a small JavaScript file that 99% of developers will never need to change, a CSS cascading stylesheet, for the look and feel, and a small HTML fragment file. By formalizing the use of AJAX in this way, one can make AJAX far more widely used among web developers.
Geertjan: So, Greg, as its creator, do you have anything to add here?
Greg: Well, what Ludo just said is pretty much the message I want to get out there. However, I'm not sure 99% of the developers would not want to mess with the JavaScript. I might put that number at 80%, as there is customization you may want to do. For Google maps, for example, you would need to use JavaScript to place the markers and so on, and in other cases you may need to wire components together. However, it is true that for the basic cases the developer does not need to know any JavaScript or CSS.
Geertjan: Does jMaki provide a response to the problem that James Gosling comments on in an interview in eWeek: "Creating AJAX components is extremely hard. Not because programming JavaScript is hard, but because all these flavors of JavaScript are ever so slightly different. You have to build your components so that they're adaptable to all the different browsers that you care about. And you have to figure out how to test them. None of the browsers has decent debugging hooks. We could build little things for people where they could test these components. The problem is that it wouldn't be exactly the same environment as being inside Internet Explorer or being inside Spark or being inside Firefox. And those environments are pretty limited. Pretty much all you can do is include a bunch of printf's—capture the log input as printf's—[with] no ability to look at variables or segue points or single-step things. There's no ability to do cross-platform QA; you've just got to do them one by one. Right now it looks pretty hopeless to make AJAX development easier."
Greg: The short answer is yes, especially for the Java developer. That said, a developer of a jMaki widget will still have to write script or wrap existing script. jMaki prescribes a way to program re-usable JavaScript. I don't agree completely with all of James's statements in that browsers to care about for AJAX are limited (Mozilla/Firefox, IE, Safari, Opera latest versions). Debugging is also more sophisticated than James describes (Venkeman and Firebug for Firefox are good examples). James is right about QA especially when it comes to AJAX needing a human to test it. Automated testing is very difficult for some things.
Geertjan: By the way, what does "jMaki" stand for?
Greg: j is for "JavaScript" and "Maki" means "wrapper" in Japanese. Therefore, jMaki means "JavaScript wrapper".
Geertjan: So how would I use jMaki?
Ludo: Using jMaki involves adding the abovementioned files, containing small snippets of code, to your web application. And the interesting thing is that the framework is extensible, so that you can add your own components, if you follow the jMaki guidelines. The current set of components are mainly DOJO. You can "jMakize" DOJO components so that they become easier to use for the non-JavaScript guru, because all that you really need to work with is a tag reference in a JSP file. But other components have also been jMakized, such as the Yahoo calendar widget and the Yahoo tree widget, as well as the Google map.
Geertjan: Can a web application that makes use of jMaki be deployed to any server?
Greg: jMaki is written as a JSP 2.0 Tag library or a JSF 1.1 component. I have only been doing the testing on the Glassfish 9 up until now, though.
Ludo: jMaki has only been tested on Glassfish (Sun Java System Application Server 9), but I can see no reason why it shouldn't be possible to deploy to other servers as well. Remember, though, that all the jMaki developers come from the Glassfish community. Developers from Glassfish are continually innovating, thinking beyond the strict confines of our specific mandate. Out of this sense of innovation, jMaki was born and continues to develop.
Geertjan: Where does NetBeans IDE fit into all of this?
Ludo: Well, think of it like this: AJAX was invented little more than a year ago. Before 2005, nobody really knew about AJAX, even though the technology was already being used in browsers. With all the new technology, like Google map or Gmail, developers are trying to see how they can reuse those ideas and extrapolate them into advanced components for reuse in their own web applications. So, jMaki is the result of Greg Murray working in this area since last year. He's the spec lead for servlets. And he's been working with Alex Russell, the DOJO creator. All that I have done, personally, is expose this framework to NetBeans users by creating a plugin that makes this framework available in the IDE. A framework is viable only if it can be used and the natural place to use it is in an IDE.
Geertjan: Ludo, which NetBeans APIs did you use when exposing the framework to the IDE?
Ludo: I used all the project APIs to add artifacts to the web application. I also used APIs needed to register the JAR files in the Library Manager. In addition, I needed the FrameworkProvider class, from the Web APIs, to extend the Framework panel with my own additions for jMaki. And, to extend the Component Palette with the jMaki drag and drop items, I made use of the Component Palette API.
Geertjan: What do you think of module development since NetBeans IDE 5.0?
Ludo: I love module development since NetBeans IDE 5.0 was released! This is because I've been developing NetBeans modules since 1999 and from 19999 to 2005 it was very hard to develop them. Now with the new module development support module, I predict (and you can already see it happening) an explosion of modules. The same effect that exposing a framework in an IDE has, in fact: an explosion of people using the framework.
One thing I do not like (and this should be an RFE) is that whenever I want to use a new API, if I add an import statement in the Java class while the API is not declared in the dependencies, the compiler complains. There should be a NetBeans editor hint to help me here! It should tell me that I need an import statement and that I need to declare a dependency and then, when I click on the lightbulb, the IDE should do all the work for me. I also don't like the dialog box for searching for APIs. It is not very usable. First of all, I always need to resize it. Also, for each module I'd like to see a list of exposed APIs in one big page. And there should be some kind of grouping instead of the very long list. For example, there could be a subcategory called "Web APIs", with child nodes for each module that belongs to this subcategory. That would make it easier to scroll through the list and find the module I need.
Geertjan: Okay, now I'd like to use jMaki. What should I do?
Ludo: Get everything you need, i.e., jMaki and, in a few days, the related NetBeans IDE plugins from https://ajax.dev.java.net/. However, maybe it would be nice to include Nicolas Desy's JavaScript Editor module for NetBeans IDE, but only if you're going to develop jMaki components yourself. Otherwise you won't really need to touch the JavaScript. And then install it all in the NetBeans IDE 5.5 Beta (or an earlier build of this release). Sun Java Studio Creator has a CSS Editor, and I am hoping that will become available to NetBeans IDE soon, for the same reason as the JavaScript Editor.
Geertjan: Finally, guys, what message would you like to convey to web developers, in relation to jMaki?
Ludo: Well, the plugin I'm providing is an initial version, just like jMaki itself is an initial version. We need a lot of feedback! It is a work in progress. Also, we need jMaki component developers. As I said earlier, the module isn't quite ready yet, but as soon as it is, we'll let you know about it.
Greg: Yes. Give it a try. I've also made some documentation available that should help you getting started: jMaki Developer Documentation, for setting everything up, Using jMaki Widgets, for integrating jMaki widgets into your web applications, and Creating jMaki Widgets, for using jMaki to create your own widgets.
Watch this spot for a follow-up interview with Greg and Ludo, as well as an announcement about the release of Ludo's NetBeans module for jMaki. Meantime, everything you need to know is available at https://ajax.dev.java.net/.
May 12 2006, 10:32:01 AM PDT Permalink


