---
title: Slave To The Intepreter
teaser:
tags: web,ruby
author: Dan Croak
published_on: 2009-10-13
---

I think of Ruby as the "free love" language. Yet, even Ruby can put the
programmer in chains.

## klass

Ever seen code like this?

    klass = Class.new

    klass.class_eval do
      def self.xyz
        'xyz'
      end
    end

    @model = klass.new

The programmer names the temporary variable "klass" to avoid a collision with
the [class
keyword](http://www.ruby-doc.org/docs/keywords/1.9/files/keywords_rb.html#M000012).

Bob Martin uses this as an anti-pattern, extolling programmers to "make
meaningful distinctions" in [Clean
Code](http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882).

## misspelling and over-abbreviation

I wrote this last week:

    attitudes.each do |tude|
      # something
    end

Cute. I re-wrote it.

The problem was `attitude` was also a method in scope.

## restricted vocabulary

I've been working on our [training
application](http://training.thoughtbot.com). The education domain is full of
troublesome terms for software:

* classes
* sessions
* forms (British)

We could start talking in terms of "workshops" or "seminars", which we may have
to for the purposes of the application, but it feels like the interpreter is
pushing us around.

I'm the human; you're the computer.

I know I'm going to be teaching a class and say things like "see you at
tomorrow's class." That's the most natural vocabulary, but the interpreter has
its own ideas.

## no way out

I don't see a way around these problems, however. Just seems like the hand
we're dealt. Any creative solutions out there?
