Over a million developers have joined DZone.

Interview:Dave Crane, Author of Ajax in Action

DZone's Guide to

Interview:Dave Crane, Author of Ajax in Action

· Web Dev Zone ·
Free Resource

Access over 20 APIs and mobile SDKs, up to 250k transactions free with no credit card required

Ajax has revolutionized the web world in the last couple of years. I read "Ajax in Action" with great interest and wrote my first review for Javalobby few years back. 5 stars. Dave Crane, author of this best selling book by Manning, tells us about the book, gives us some alternatives to Ajax, and some popular tools and libraries, and many more tips in this interview. Read on....

[img_assist|nid=2359|title=|desc=|link=none|align=left|width=75|height=100]1. Dave, tell us something about yourself. Who you are, where are you located, and what kind of work do you do?

Hi Meera. I'm a software developer, I've been working with the web since the mid-1990s, using Perl, PHP, Java, Python, Ruby, Groovy and various other technologies. I kept bumping into Javascript in a variety of jobs, and didn't really like it for a long time. Round about 2004, working on a project with a very heavy dose of what later became known as Ajax, I realised that Javascript was actually quite an interesting language, and started to write about some of my experiences - both good and bad - with using it.

I'm based in the UK, currently in a town called Stroud in the rural South West. I work for a start-up company called "Historic Futures", as Senior Developer and Architect, using Ajax and other web technologies to tell the story of the global supply chains behind organic, fair trade and other best manufacturing practice goods. Our clients are truly global, presenting us with a lot of interesting technical challenges in delivering rich web applications to remote parts of the world.

I also work with the UK training company Skillsmatter, as course developer, teacher and mentor on their Ajax offerings. We run courses in London, in the US and in Europe, as well as on-site training globally. Personally, I teach five or six times a year, and I've met a lot of interesting and talented through my teaching work,

2. Your book "Ajax in Action", was published in 2005, are you planning on writing a second edition?

Well, "Ajax in Practice" in 2007, was a sort of second edition, although the focus was slightly different. Back in 2005, there was a great buzz around Ajax, and not a lot of awareness. Now, it's a standard part of a of of developer's toolkits, and the landscape has matured considerably, so if I were to write a second edition, I think it'd have to be a very different kind of book.

3. Ajax has become the most popular acronym with web development, can you explain why?

It's funny, isn't it. As a technology, Ajax doesn't really offer very much, it's just a programmatic HTTP client. I think it's role was catalytic - it releases a lot of pent-up potential in the whole DHTML stack that previously had nowhere to go. Technologically, it opens up a lot of interesting avenues. In useability terms, it raises the bar of what's possible. And in business terms, it opens up a whole new set of opportunities for putting line-of-business apps into the browser. The public-facing Ajax driven sites like Basecamp, Facebook, Flickr, et al. are just the tip of the iceberg. There's been a huge amount of Ajax deployment within intranets and extranets too.

Also, like the internet itself, Ajax has a low barrier to entry - anyone with a text editor can pick it up and get started.

4. Can you explain to our readers how Ajax and Java can be used together?

Ajax is primarily a client-side technology. It can be used with any server-side systems. You can combine Ajax and Java using plain old JSP's if you like - just get it to output XML, JSON data or generated script rather than entire HTML pages. However, the Java community has embraced Ajax in a big way. Many of the popular frameworks provide good support for Ajax, or are even designed around it. An entirely subjective list - based on my own experience - would include Grails and DWR near the top. Many of the JSF toolkits such as ICEFaces, Seam and Backbase also build in support for Ajax. There are many choices.

5. What alternatives do we have if we don’t want to use Ajax?

Ajax doesn't make a perfect fit for every project. In some cases, classic page-based web applications will do the job. For presentation, Flash can still do things that Ajax can't, and Adobe are making a lot on interesting moves in the RIA space with Flex and AIR, that provide some very nice complements to Ajax. Microsoft's Silverlight is also floating around in this area, although I don't know it well enough to say much about it.

For the Java developers, there is always Java Web Start as well. It's never quite made it big time, and the JDK isn't distributed widely enough amongst the general public to make it a serious contender for public internet projects, but in some internal apps, Web Start can do things much more efficiently than Ajax and still offer the benefit of centralised deployment and upgrades.

6. What IDE do you use for Ajax development?

I use Eclipse. It's a personal habit - I know a lot of people who get good mileage out of Netbeans and Intellij IDEA too. I like Eclipse for essentially conservative reasons - it has the biggest community of plugin developers, so when I've picked up a new technology in the past (like Groovy, Rails, Hibernate or Scala), there's usually been an Eclipse plugin sitting around waiting to help out.

7. Can you tell our readers about some popular Ajax tools and libraries?

Yes. Prototype deserves a mention, as do jQuery, Dojo, Mootools and Ext. There's been quite a convergence of toolkits over the last year - you'll find most of them offering similar features for helping out with the common tasks in Ajax development, like navigating the DOM using CSS selector rules, programmatically attaching events to the UI, high-level Ajax helpers that make it easy to work with XML and JSON, that sort of thing. Reading a library like
Prototype or jQuery can give tremendous insights into how Javascript works, and how to exploit it's strengths. A lot of people, like me, came to Javascript from an OO background, and began to work on it using OO thinking. Javascript also has a rich functional programming streak to it, and using these libraries can help to acquaint a developer with the functional idioms that make Javascript really fun to work with.

8. What’s the impact of Ajax on the server side as well as the client side?

It can be quite significant - if you look at techniques like Comet, it can have ramifications beyond the server-side frameworks right down into the web server itself. Jetty is making great strides in this direction, for example, as is Resin.

In the more mainstream Ajax project, though, you can still see changes. There's te possibility of moving a lot of the workflow based intelligence up to the client, and maybe ending up with a presentation tier that looks more like a web service than a standard web app.

9. Are there any tools that can help developers to debug, monitor, and test Ajax applications?

Yes, there are. I'd recommend Firebug to any Ajax developer, the Microsoft debugger and Web Developer Toolbar if you need to work with Internet Explorer. LiveHTTPHeaders and Fiddler are also good tools for monitoring and debugging the HTTP conversation.

Testing is making it's presence felt in Ajax these days too. JsUnit and tools like TestMaker have been around for some time, and more recently, Selenium has raised the bar, by making it easier to test the user interface as well as the HTTP interface and Javascript business/workflow objects. Selenium can now drive most web browsers programmatically, including IE, it's an amazing piece of technology.

Thanks Dave for the interview. 

#1 for location developers in quality, price and choice, switch to HERE.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}