O'Reilly logo
  • joseph isaac thinks this is interesting:

The benefits you achieve by using this technique vary, as always, based on your personal situation. If you are working on a method whose parameter list is lengthy and wildly unstable, in a framework that is intended to be used by others, it will likely lower overall costs if you specify arguments in a hash. However, if you are writing a method for your own use that multiplies two numbers, it’s far simpler and perhaps ultimately cheaper to merely pass the arguments and accept the dependency on order.


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


Use the hash argument appropriately. If there are a large number or unstable list of arguments then pass a hash. Otherwise, if the argument list is short/simple or stable then pass them in a specific order and no harm will be done. Use your judgement.