MetaSkills.net

Hell'OO HomeMarks

Posted On: August 17th, 2008 by kencollins

Well HomeMarks v2.0 is done and ready for the public. You can download it from my Github project page. It has a real simple rake app:bootstrap task that I came up with over the weekend will have you running a local copy in only a few seconds, give it a try. Sometime over the next few days, I'll move over the live site to this code base too. If you have not yet kept up on the implementation mantra I set down for the HomeMarks v2 project, you might want to read an older post as well as this excerpt from the project README.

HomeMarks was built using the Ruby on Rails framework with a heavy emphasis on object oriented JavaScript to make AJAX requests to a RESTful back-end. Unlike most Rails applications it does not use any inline JavaScript helpers nor does it rely on RJS (Remote JavaScript) for dynamic page updates. Instead it is nearly 100% unobtrusive JavaScript which uses simple HEAD or JSON responses to communicate to the objects on the page. This has yielded very slim controller code which is decoupled from the views and easily testable in isolation at a functional level.

So what do I think of this implementation and writing all this object oriented JavaScript? Well – its been real hard, I've been in JS Hell-OO for the better part of a few weeks as I came closer to finishing the project. Coming from a self inflicted addiction to unit/functional testing in rails, it is very hard to get into the habit of opening the browser to test view code. A big part of me hates writing all this JS without one bit of unit testing. I've heard that Prototype v2 will have unit testing, that would be awesome!

Hell'oo for HomeMarks

So, bitching aside, I am very happy that my JS-fu is stronger. The end result besides all those buckets of water up the hill is that I can now really appreciate the ruby object model and how prototype strives to make JS class construction follow its example. Kudos really goes to Sam Stephenson for bridging the two object models. As I learned more about how prototype's classes work, I actually learned quite a bit about ruby too. Using that knowledge I gave a talk at the Hampton Roads Ruby Users Group (757rb) on the topic. You can download the PDF version of the slides from the files section of the Google group page. Look for the file titled OO JavaScript Class Construction

Dr Nic

  HOMEPAGE  | August 18th, 2008 at 03:49 PM
Dr Nic For JavaScript unit testing perhaps look at http://jsunittest.com (which is a rewrite of the unit test library used by prototypejs internally but without any prototypejs dependencies) and http://newjs.rubyforge.org which is a gem that includes a javascript_test rails generator (script/generate javascript_test some_js_file_to_test). I think I have a blog post of running the js tests via a script/js_autotest which makes it a much nicer process.

Ken Collins

  HOMEPAGE  | August 18th, 2008 at 03:57 PM
Ken Collins Thanks a lot Dr Nic! I will take a look at those libs tonight.

gae gast

  HOMEPAGE  | September 5th, 2008 at 12:25 PM
gae gast Hello , We are interested to migrate in Ruby ours websites and to start a socialnetwork around our marine system project. HomeMarks seem to me very well done but we have no expereience on Ruby. Our experience it's on Java , Javascript , Lotusdomino.. We are looking to some help to start Ruby inside our team implementing togheter some application. By the way..our marine system is the integration of boat control , entertinement , internet connections for people like to work sailing. the sytem is Mac based . Your experience on clustering is very interesting .