O'Reilly logo
  • Gustavo Lopez thinks this is interesting:

 1    def diameters
 2      wheels.collect {|wheel|
 3        wheel.rim + (wheel.tire * 2)}
 4    end

This method clearly has two responsibilities: it iterates over the wheels and it calculates the diameter o...


Cover of Practical Object-Oriented Design in Ruby: An Agile Primer


Simple piece of code BUT WITH 2 responsiblities ....

Example of wrong code