Relation from RailsConf Europe, day 3

Welcome to the final part of my RailsConf Europe 2008 coverage. On the third day I attended Ruby and Rails Symposium: Versions, Implementations, and the Future, Genomes on Rails and Small Things, Loosely Joined and Written Fast. The keynote was a little bit disappointing, but the other talks were both inspiring, albeit in different ways.

Ruby and Rails Symposium: Versions, Implementations, and the Futures

David Black’s keynote, or a Symposimi, as he called it, started with a show of hands. David asked what version of Ruby are people using on their production site. Almost all of the audience raised hands for 1.8.6, I noticed only one guy using 1.8.7 and maybe two using 1.9.0. This is not that surprising as 1.9.0 is a “development release”, not intended to be run in production environments. It’s more interesting why 1.8.7 didn’t achieve more popularity. It’s supposed to be stable, backwards compatible, has many bugfixes and some new features backported from 1.9.0. There have been also many vulnerabilities discovered in Ruby, so everybody should recently have installed some new version and why not 1.8.7? But I digress.

Live coding session during David Black's keynote

Live coding session during David Black's keynote

David showed then some more prominent differences between 1.8.6 and 1.9 version in a live coding session. These included:

  • differences in block parameters handling (1.9 doesn’t overwrite previously existing local variables when a block happens to have identically named parameters),
  • new lambda syntax, i.e. the -> operator, which allows lambdas to have optional parameters as in func = ->(a,b=1){puts a + b},
  • enumerators,
  • new hash syntax: {a: 1, b: 2, c: 3} which is equivalent to {:a=>1, :b=>2, :c=>3}, i.e. creates a hash with symbols as keys.

This is hardly news for anybody not living under the rock for the last few months, there have been many announcements and blog posts on the upcoming features. I think it would be more interesting to hear something about Ruby 2.0.

Genomes on Rails

Matt Wood started with introducing the Wellcome Trust Sanger Institute, where he works. The institute was involved in Human Genome Project and is currently running many other scientific projects about genomes, DNA and other things that generally require massive computation on even more massive data.

Human genome took 15 years to decode and was comparable with decoding a 3 billion letters message. The project costs were about $3 billion. To date they have decoded genomes of 40 species. They are also trying to find cures for various diseases, from diabetes to malaria.

Rails is used to power the web pages that provide access to research results. Matt told us that most of the models consist of “virtual fields”, that is key-value pairs stored in separate table. This is not that hard and that slow as it may seem and has several advantages, like the ability to automatically generate the UI based on the database contents. Since they query large tables in their Rails apps, they use their own plugin called denormalizer.

Me, enjoying the desserts

Me, enjoying the desserts

At the end of the presentation somebody from the audience asked the question that I’m sure everybody wanted to ask: “Do you do any of those computations in Ruby?” “No.” Matt replied, “that would be crazy. The computations are done in C. Ruby (and Perl) are used to instrument the processes and for the web pages.” Be sure to check out Matt’s presentation.

Advanced RESTful Rails

This was the second talk by Ben Scofield that I have been to. I think it was very valuable for anyone doing RESTful applications in Rails. Ben started with showing some situations that might not be easy to handle RESTfully. These include singleton resources, namespaces, nesting, polymorphism and custom routes.

RESTful development consists of two steps: identifying resources and selecting methods to expose. Ben offered some tips for identifying resources. Firstly, when in doubt add a resource. It is better to have too many of them that too little. Secondly, respect the middleman. So, a many-to-many relation (like friendship) is almost certainly a resource, even if you don’t have a model for it. And lastly, resources are not identical with models. Most of the models are resources but not all resources have models.

In the next part, Ben showed some example solutions for things like password resets, homepages, previews (as in preview comment before posting), searching, wizards (multi-step actions), bulk actions (updating many resources at once) or transactions. Check out his presentation if you’re interested.

Small Things, Loosely Joined and Written Fast

This was one of most entertaining talks on the RailsConf. Justin Gehtland put on quite a show, with lost of running, waving hands and screaming (don’t be afraid, not Steve Ballmer style). He had also very funny slides with references to Star Wars. He compared big, complicated applications with the Death Star: they are heavy, costly, have too many responsibilities and easily break. Then he showed the Rebel Fleet – a chaotic cloud of small, cooperating ships playing different roles. Of course, some of them can get hit but it’s much more difficult to destroy the whole fleet than one ship, even as big as the Death Star. And it’s easy to replace the small ships with new ones.

Justin proceeded then to show us what this “Rebel Fleet approach” could look like in case of Rails applications. His example was a simple students portal with two functions: lectures enroller and dormitory picker. Those two functions were implemented as separate Rails apps, sharing as little as possible (students data and their preferences). Justin also set up a Single Sign-On server for them (a RubyCAS server) and a message queue (ActiveMQ) for communication between the apps. If this sounds to you as interesting and inspiring as to me, be sure to check out Justin’s blog entry with code from the talk and setup instructions.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: