- the possibility to access and modify the DOM on the server before it is sent to the client (you can even use the canvas API to dynamically create images)
- the possibility to share code between the client and the server sides (you only have to write your form validation logic once)
- the possibility to call server side function from the client side (using invisible ajax requests)
I’ve chosen ActiveJS because it is built originally for Jaxer and thus doesn’t require any configuration to get started if you are developing with Aptana Studio. Moreover, the ORM layer of ActiveJS (ActiveRecordJS) offers an abstraction not only to MySQL and SQLite databases (on the server side) but also to client-side persistence such as Google Gears or the SQLite database that is to be found in Safari and the iPhone Web browsers. Its route component is similar to the Ruby on Rail’s one but also offers deep linking on the client side, in the Jaxer spirit.
Hacking into ActiveJS
Because ActiveJS is still young, it is really likely to miss some features that might be important for your project and the best solution will be to hack into it instead of waiting for someone else to do the job. So here is how to configure a development environment to be able to build ActiveJS from sources (as a reminder for myself):
- I assume you are developing with Aptana Studio and you have the Jaxer and Git plugins installed.
- Fork the ActiveJS repository on Github.
- Import it as a project in Aptana (File > Import > Git Repository, choose git+ssh as the protocol and don’t change the username)
- Ruby needs to be installed in its 1.8 version because the build script depends on ftools, which is deprecated in ruby1.9. With Ubuntu and probably other linux distribution, the ruby-dev package is required as well.
- The package rubygem is then required to install most dependencies of the build script: json, packr (beware, this might soon be replaced by YUI) and rdiscount. In any case look at the beginning of build.rb to find the dependencies of the script.
[code lang="shell"]$ sudo gem install rdiscount [/code]
- Remember to configure your editor to use 4 spaces instead of tabs and try to respect the coding style.
Et voilà! You’re ready to change the files in the src folder, build active.js, test your modifications and send pull requests to the original branch.
$ ruby1.8 ./build.rb compress
My first tasks will be to improve the relationship features because it doesn’t behave as a proper ORM layer currently and to add support of HTML5 elements to the view component.