Stampy

Dev Blog

RailsConf 2014 Roundup

Last month, two of us attended RailsConf in Chicago. There were so many great talks, and we had a great time meeting lots of other developers from around the world. Here are a few of the amazing talks that we saw:

Gordon Diggs

Mutation Testing with Mutant - Erik Michaels-Ober

Video

I had never heard of mutation testing before, but came away with a really great understanding of the idea as well as how to use this specific library. Essentially, mutant changes your code at runtime, and asserts that some test fails with that change. For example, if you have a conditional like

1
if a && b

mutant will change it to

1
if a || b

If you have proper test coverage, when b is false and a is true, some test for this method should fail. It’s a great way to better measure your test coverage.

Technical Onboarding, Training, and Mentoring - Kate Heddleston

Video

This talk reminded me of how good of a job we already do onboarding people here at Paperless Post, but gave me the idea to formalize and document the process better. Kate makes a lot of great points; I especially liked the idea of journaling, giving a new hire a place to keep and share thoughts in their first few weeks.

All the Little Things - Sandi Metz

Video

Sandi Metz’s talks are always great. In this talk, she goes through refactoring some complicated code into smaller, better parts. There were a few key takeaways that I really liked. First is The Squint Test: Sandi suggests that the complexity of code can sometimes roughly be measured by observing the changes in shape and color. Things with greater variation of indentation will likely be more complex. The second is that refactoring might introduce more complexity in the interim. Sandi didn’t shy away from making the code a little bit more complex as she worked toward her solution, knowing that she would be able to reduce that complexity towards the end of the process.

Ivan Tse

Where did the OO go? Views should be objects too! - Andrew Warner

Video

Andrew Warner explores an interesting concept on how to handle views in a web application. There are several ways one could render views. For single page thick client applications, the view is written in javascript while the server returns data. For document based applications, the server renders full HTML pages. There are pros and cons for each option but if you were to implement an application that uses both solutions, you would end up with duplicate views - one on the server and one on the client. Perspectives is a gem that helps solve this issue. The underlying concept is that Mustache is used as the lowest common denominator and Rails can render either the full HTML page or the JSON to populate the template.

Rails as an SOA client - Pete Hodgson

Video

This talk explores tools and techniques when your Rails application begins to turn into a SOA client. One of the biggest takeaways I got from this talk is the concept of middlewares in Rack and Faraday. I knew previously that middlewares are like mini-Rack applications that can modify the request as it comes in from the server or the response as it comes out of our Rails application. Similarily, Faraday operates in the same fashion but in the opposite direction. There are middlewares that can modify the request before it goes out and the response before it comes in.

Class Reloading in Ruby on Rails: The Whole Story - Xavier Noria

Video

This talk gives a brief overview of Ruby constants the three algorithms Ruby uses for looking up constants. Then, Xavier Noria contrasts Ruby’s lookup with how Rails loads constants and how it implements autoloading. This was quite an in-depth techincal talk and I recommend watching this if you want to take a dive into constants and Rails reloading. Some of the things I learned include: Module.nesting, require_dependency, and constant tables being stored in the Module instance objects.

Comments