Tag Archives: & ActiveRecord


jChat – YUI, Jaxer, & ActiveRecord


For those familiar with MiaCMS you’ll already know I’m a huge fan of the Yahoo! User Interface Library (YUI).  I recently finished up the JavaScript work for version 4.8 of MiaCMS.  With some free-time on my hands I figured what better way to fill it than with a new project?  So I set out to learn some new technology and see how I might mash it up with some existing skills like YUI.  The new technologies I decided to experiment with were Aptana’s Jaxer and their new ActiveRecord.js framework.

Jaxer ships with a number of basic samples, but I’ve seen quite a few people online in search of more complex examples and specifically ones that make use of the new ActiveRecord.js library.  The extended example I developed is called jChat.  jChat is fully functional chatroom application that demonstrates integration of the following web related technologies; HTML, CSS, JavaScript, MySQL, YUI, Jaxer, and Activerecord.js.

jChat’s DOM access/manipulation, event handling, and animation code makes heavy use of YUI.  The YUI Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX.

Jaxer is an Ajax Server that will allow us to built entire applications using JavaScript and Ajax.  The theory being that JavaScript experts can build applications without needing additional server side languages (ex) PHP.  There is nothing wrong with PHP, in fact is just so happens to be one of my favorite languages, but the important point to be made here is that Jaxer eliminates the requirement for additional server side languages.  That being said you don’t have to do away with server side languages and in some cases it might make a lot of sense to utilize Jaxer with a server side language like PHP.  Another added bonus developers get with Jaxer is code reuse.  Typically we see develops implementing similar functionality in multiple languages to handle things like data validation for example.  With Jaxer it is possible to write the JavaScript validation code once and utilize it both client and server side.  This could therefore lead to less debugging, simpler testing, and faster time to market.

ActiveRecord.js is a cross browser, cross platform, JavaScript ORM.  ActiveRecord.js makes it easy to begin working with databases in JavaScript on the client or server, with Google Gears and Chrome, Aptana Jaxer, Adobe AIR or any platform supporting the W3C HTML5 SQL Specification (currently Webkit and iPhone).  Overall I found ActiveRecord.js simple to integrate and a pleasure to use.  I found a few bugs initially (mostly just some sytanx issues preventing proper minification).  Thanks to the power of github I was able to fork it, make some modifications, and submit a pull request which they ultimately accepted and merged with the master branch.  I’ve been working on another Adobe AIR related project which I started before the first beta release of ActiveRecord.js.  It makes use of AIR’s native support for SQLite, but I’ll more than likely rewrite the database code to make use of this new library which should have the added benefit of easing application updates/database migrations down the road.

I’ve put all the source code up on github so that others can benefit from my learnings.  Chatrooms have been done a million times so jChat is less about the overall application functionality and more about the pairing of technology.  Feel free to download, learn from, and/or fork jChat on github – http://github.com/cauld/jchat/tree/master.  Comments, suggestions, and contributions welcome.