def show(args) some_other_object(args) endor
def show(opts) .. lots of code bar = opts[:foo] opts[:bar] endand also:
def show(name, params) some_other_object(name, params[:foo]) endI see some problems with such code:
1. It's hard to tell, when you call the method, what is really required/expected to pass in.
It's less of a problem, when you can see in the method body what is used. But it's not always the case. Often the params are passed further, so you have to look around and think hard how the params are used.
2. (args, opts, params) as names sound very generic, they don't tell me too much.
I understand that hashes are quire useful sometimes. But it's a similar situation like the one where we would call a variable a var_1.
Why don't we, at least, give them good names, like address_hash or html_options or maybe game_configuration?
3. It's a missing object smell.
Very often, to me, the examples above are code smells. There's a missing object somewhere. Especially when this data is passed further. Maybe it's Address object, maybe PopupContent, whatever sounds good in your domain.
What's your opinion?