I think of Ruby as the “free love” language. Yet, even Ruby can put the programmer in chains.
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.
Bob Martin uses this as an anti-pattern, extolling programmers to “make meaningful distinctions” in Clean Code.
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.
I’ve been working on our training application. The education domain is full of troublesome terms for software:
- 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?