🚀 Take the Ruby on Rails Community Survey and help shape the future of Rails!
Article  |  Development

Future Talk with Sandi Metz

Reading time: Less than a minute

New Relic Office Building

Several of us from Planet Argon were amped to see @sandimetz talk in Portland. So we took the trip over the river to New Relic’s offices in downtown Portland. The essence of her talk can be found here.

Though I’ve been working on Rails apps for about 5 years now, I’m still incorporating the idea of “small objects that pass messages to each other” into my own code. The part I find difficult is we often inherit code written by someone else who didn’t follow these rules, so we are starting at a distinctly more difficult point then if we had started the app ourselves.

She suggests whittling down the large classes as you add features, rather than trying to rewrite it all at once. I’ve found that difficult in practice and haven’t been able to work it into very many features so far. She discusses this, “Once an object gets to a certain point, it would be irresponsible NOT to put related code in there because no one would be able to find it.” So the key is keeping it from getting to that point.

I think the biggest issue is this makes one of the most difficult problems in Computer Science even more difficult. What do you name all of these small objects? I’m terrible at naming things, and I don’t know anyone that loves it. Naming is all about communicating a concept with nothing more than a “handle” but coming up with a short handle that communicates the same concept to everyone is tricky. For example, we just had a discussion recently around here about naming a class. The first name suggested was StatementFilter, which told me something about what it was responsible for handling (I didn’t look at the code, but had a verbal description for what the class was doing). But what we settled on was BillingStatement. I was confused because I was thinking about SQL statements up to that point.

My overall take away from the talk was that it didn’t really matter what rules you followed specifically, but the fact that you and your peers upheld a social contract. It is a way of telling your fellows that you want to work together for the future, and not just yourself and the current moment, and that’s something I think we can all agree is a way to Make It Happen.

This is the video from her talk in Barcelona:

Have a project that needs help?