Introducing Taconite
By now, you've heard all the hype, you've used Google Maps and you know what Ajax stands for. Heck, you even have the perfect place to use Ajax in your app to finally solve that problem your users have been complaining about since your first release. With baited breathe, you sit down in front of your favorite editor and then it hits you: Ajax is hard.
Let's see, your customers use IE, Firefox, heck a few even use Opera and oh yeah, you have a persistent set of Safari users. You spend an afternoon tearing out your hair trying to figure out what the work around is for your nifty new feature in your new least favorite browser. Dejected you shout," Isn't there a better way? Will I ever see my cat again?" Has anyone fed the cat? We understand and we can help (we have cats). We offer you an alternative, we offer you Taconite.
What is Taconite?
Taconite is a framework that simplifies the creation of Ajax enabled Web applications. It's a very lightweight framework that automates the tedious tasks related to Ajax development, such as the creation and management of the XMLHttpRequest object and the creation of dynamic content. Taconite can be used with all modern Web browsers (Firefox, Safari, IE, Opera, and Konqueror, to name a few) and can be used with any server-side technology including Java EE, .Net, PHP, or any language that lets you return XHTML.
What's New (18 December 2007)
What a busy year!! Taconite continues to be used in some large-scale Ajax applications and is doing wonderfully. Some very impressive applications implementing Ajax can, and have, been built using Taconite. Taconite is immensely powerful yet simple to use; there's not much code to break, and it can be used anywhere, with any server-side technology.
I'm still surprised that (to my knowledge) no other Ajax framework works anything like Taconite, and it's too bad that Taconite hasn't been covered more in the "mainstream" tech media.
What's New (23 May 2007)
Taconite 2.0 is now available for download!! The recent additions to Taconite were vast enough that we decided that a full increment of the major version number was warranted. Here are some of the highlights:
- The concept of the context node has been greatly expanded. Previously, Taconite offered a contextNodeID by which you specified the context node by it's ID attribute. Taconite 2.0 expands on this by also offering a comma-separated list of values for the contextNodeID so you can specify multiple context nodes. But wait, there's more! Taconite 2.0 also provides the ability to use pattern matching of the contextNodeID via regular expressions.... and to top it off, now you can also specify context nodes by CSS selector rules!!
- Internet Explorer's incredibly broken implementation of a select box with the "multiple" attribute has finally been worked around, so you the developer shouldn't have to do anything special to handle it. Thanks to the community for getting us started with some contributed code.
- Compressed versions of the Taconite JavaScript files are now included in the distribution. This means that a fully functional, completely cross-platform Ajax solution is now available at less than 25 kb!
- The JSP-tag based parser has officially been laid to rest. The source code is available in CVS, but is no longer included as part of the distribution as it hasn't been maintained in well over a year. The JavaScript based parser is superior in every way. The upside to this is that the parseInBrowser="true" attribute is no longer needed.
- Many, many minor bug fixes and tweaks.
- Despite the huge number of improvements, Taconite 2.0 should be 100% backwards compatible with existing Taconite-based solutions. Please notify us if you find something that is not backwards compatible.
We spent a significant portion of our time upgrading the examples to highlight the new features in Taconite 2.0. Using Taconite is now easier than ever, which is a great accomplishment considering Taconite is now more powerful than ever! This release improves upon Taconite's promise to shield you, the developer, from having to worry about browser incompatibilities when dynamically updating content via Ajax operations.
Now that Taconite 2.0 is out the door, please report any bugs to the Taconite help forum. Also, let us know if there are other features you'd like to see in Taconite. We will certainly consider any and all suggestions!
What's New (18 April 2007)
Great news!! I'm happy to announce that Taconite has gained a new committer. Sergio Bossa has graciously agreed to become a Taconite committer. Sergio has plenty of experience with Taconite, as he is the maintainer of the Spring XT module, which is an Ajax module for Spring based heavily on Taconite. He has contributed a few high-quality patches to Taconite, and it quickly became obvious that he deserved CVS commit access to the Taconite source code.
This is a huge win for Taconite and the Taconite community at large. Please join me in welcoming Sergio!
What's new (07 March 2007)
Taconite continues to generate good reviews and gain users, despite the fact that it has little to no marketing. Ajaxian.com recently reported that an online game uses Taconite. I was also happy to hear that there's a Taconite plugin for the popular jQuery library.
I'm also happy to report that at my own day job, I'm building an application that uses Taconite extensively for Ajax operations. The application completely breaks the old paradigm that browser-deployed applications have to be dull and boring. This application has only three main pages; off those main pages, sub tasks are completely by opening small modal dialog windows from the page. The user doesn't have to navigate to a different page to complete a small task, and thanks to Taconite (along with gzip compression of the Taconite response) the modal dialogs appear almost instantaneously, and that includes database operations on the server side to populate the dialog. I'm happy to report that Taconite has performed admirably, with great performance and ease of development. The other members of the team quickly learned the simple Taconite APIs, something that can't be said for all Ajax frameworks.
Theory of Taconite
As you all know, the XMLHttpRequest object is not officially part of any Web standard including W3C standards. However, the good folks at the W3C recognize that the functionality provided by the XMLHttpRequest object is extremely useful and should be recognized with its own official standard. Hence, the W3C created the Document Object Model Load and Save specification.
We decided to work smarter and not harder, so instead of inventing our own way of Ajax-like interactions, we decided to leverage the great work already done by the W3C. So, Taconite is based on the concepts behind the W3C's Document Object Model Load and Save specification. We figured that who ever created this specification really knew what they were doing, so why not base our work on theirs?
How Does Taconite Work?
Now that we have your attention, we'll let you behind the curtain. The heart of Taconite is a parser that converts normal (X)HTML code into a series of JavaScript commands that dynamically create the content on the browser. This parser allows you, the developer, to write content in way that is natural -- as (X)HTML. You no longer have to crowd your pages with a slew of document.createElement and document.appendChild commands to dynamically create new content. The parser takes care of all this while you sit back and enjoy your refreshing iced mocha! The resulting JavaScript is evaluated by the browser's JavaScript engine to produce the content specified by the (X)HTML.
The Taconite custom parser is implemented as a set of JSP custom tags, which can be used in any Java servlet container, or as a client-side JavaScript library, meaning it can be used in conjunction with virtually any server-side technology.
Advantages of Taconite
Taconite isn't the only framework out there, we know that. That said, Taconite doesn't try to reinvent the wheel. We focus on the Achilles heel of Ajax development (and here you thought we were only going to talk about one ancient Greek hero): the potentially tedious task of writing large amounts of JavaScript to dynamically update the Web page. Of course maybe you really enjoy pouring over thousands of lines of JavaScript (hey, we're a tolerant bunch) but then Taconite probably isn't your cup of tea (or iced mocha).
Unlike some frameworks, Taconite doesn't try to invent a new way of sending request data to the server, instead relying the tried-and-true name/value pairs either embedded within the query string of a GET request or tucked safely in the body of a POST. The client-side library even automates the creation of the name/value query string; heck, we even escape the data for you. All you need to worry about is telling Taconite what values should be sent to the server and we'll take care of the rest.
Since all of the JavaScript is created by the parser based on the HTML you specify, you don't have to worry about dealing with browser JavaScript incompatibilities. The parser takes care of them all for you. Let's repeat that so it can sink in: you don't have to worry about browser incompatabilities. You're welcome! All you need to do is specify the dynamic content as HTML within a JSP, and the parser does the rest. Pretty sweet, huh?
innerHTML Avoided
Many of the currently available Ajax frameworks rely on the innerHTML property to dynamically create and update content on the Web page. Taconite completely avoids the use of innerHTML. Why, you may ask? I'm glad you asked!
The main problem with innerHTML is that it's non-standard. It is not specified by any W3C recommendation, although it is supported by most of today's browsers. Yes, we know, the XMLHttpRequest object is not standard either. But, the XMLHttpRequest object has a similar W3C specification, unlike innerHTML. If you're like us, you're committed to adhering to standards whenever possible. The W3C DOM JavaScript commands produced by the Taconite parser adhere to standards as much as possible, deviating from standards only enough to ensure wide browser compatibility.
Another problem with innerHTML is that it really only applies to HTML documents, not XHTML documents, which is what the industry is moving to (you are trying to make your Web pages XHTML compliant, right?). XHTML is really just HTML that conforms to a strict XML DTD, where HTML is somewhat more haphazard. As browsers move to better, more strict support for XHTML documents, they may not support innerHTML due to its non-standard nature.
Coming as a suprise to absolutely nobody, the innerHTML property has its own browser to browser quirks. For example, IE won't allow the innerHTML of a <table> to be appended to. So, if you want to append one row to a table using innerHTML, you'll have to reproduce the entire contents of the table tag, with the one new row added at the end. That's just a waste of processing time and bandwidth.
Using the innerHTML property doesn't give much control when it comes to placing the new content. For instance, what if you want to insert a table row between two existing table rows? Using the innerHTML property, you would have to reproduce the entire table. Taconite gives you great flexibility to specify where content should be placed. In fact, this concept is straight out of the W3C DOM Load and Save specification.