Archive for the 'rubyonrails' Category

RailsConfEurope: Keynote DHH – Living with legacy software

The keynote of David Hennemeijer Hanson this morning was not really about technology, but more about us developers using the technology (in this case Rails). He made a good point about legacy software: that it’s more an opinion of us, than a property of the software itself and that it’s a reason to celebrate when we consider our software legacy: we have learned and grown as software developers.

Not really easy to summarize the session right now, but when I have the slides I will try to summarize the session because it was quite good (it made me think differently about legacy software) and David had some nice examples of how he refactored the Basecamp codebase (the flagship product of 37signals).

RailsConfEurope: Meta-programming ruby for fun & profit

The second tutorial I followed was a tutorial called ‘meta-programming ruby for fun & profit’ by Neal Ford of Thoughtworks.

Quite interesting stuff, a bit complex though. Will have to study this again with the slides at hand to really understand this level of meta-programming. When I do I might write another post on this session and topic :)

Slides: www.nealford.com under conferences

RailsconfEurope: Accessible Ajax on Rails

First day at RailsConfEurope in Berlin!Following a tutorial on Accessible Ajax on Rails now by Jarkko Laine.

Accessible Ajax on Rails
View SlideShare presentation or Upload your own. (tags: rails ajax)

Jarkko started with an explanation of the need for unobtrusive javascript. It basically boils down to separating your javascript from your html into a separate javascript file (like you separate your styling from your html in a separate css file). That has a couple of benefits: cleaner design, separation of concerns and a more accessible website (if you take a bit of extra care, the website will also works without javascript).

The tutorial part started with a simple todo list application that used the standard Rails Ajax helpers (e.g. link_to_remote) . Problem with these Rails helpers is that they are not unobtrusive (they generate a lot of javascript code throughout your html code = no separation of concerns) and your site doesn’t work anymore when javascript is turned off (or is not supported).

Jarkko then showed how to separate the javascript from the html (like separating styling in a css file) and reattach it with css selectors with a really nice javascript framework for unobtrusive javascript called Lowpro. Lowpro is based on the Prototype javascript library that comes with Rails.

I first heard about the Lowpro library at the RailsconfEurope in London, 2006. Since that time, the LowPro library seems to have grown up.

Especially the Behavior classes are a really nice way to structure event handling code a bit more “object oriented”. These Behavior classes play the role of the controller in the MVC pattern used in Rails, but then for the client side javascript code.

Lowpro also has a niceset of default behavior classes (e.g. for a remote form).

The concept of event bubbling and event delegation was a nice eye-opener for me. This allows you to add a behavior to a top level element (e.g. an ul) and then delegate the event to a child (e.g. a li). This way you don’t always have to use reload the behaviors after an ajax call (when you only update the childs of course!). Lowpro has nice methods for all this off course. There are some problems with event delegation though: not all events bubble up (most notably focus and blur) and it can kill performance in somce cases (notably onmouseover).

Definitely worth learning more about. I will try to use it in my work projects and a project I am working on now in my free time (a community where people can share physical stuff with their friends, neighbours, colleagues etc.) but more on that in a later post.
Resources:

Presentation on SlideShare: http://www.slideshare.net/supervillain/accessible-ajax-on-rails-presentation
Lowpro svn repo: http://svn.danwebb.net/external/lowpro/trunk/
Tutorial code: http://github.com/jarkko/unobtrusive_book_code/tree/

Leaving for Railsconf Europe 2008 in Berlin

Together with a colleague I am leaving now for RailsConf Europe 2008 in Berlin! We will be driving there by car and return next thursdag night.

We hope to meet a lot of interesting people at the conference and learn a lot about the newest in Ruby on Rails.

« Previous Page