Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I recently found myself writing the following:

task :spec do |t, args|
  require_relative 'spec/helper'
  helper = Library::Specs::Helper
  helper.start_coverage
  if condition
    helper.do_something(foo)
  else
    arr.each do |el|
      helper.do_something(el)
    end
  end
end

My question is: is it bad practice to assign the name of a class to a variable to save space? Clearly, it makes the code much terser and readable. Are there any downsides?

share|improve this question
1  
What kind of downside are you thinking of? that it's less clear what you are calling? I cannot think of anything, people do it all the time and it just works. – tokland Dec 12 '12 at 7:01

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.