|
|
|
|
|
by sandal
5934 days ago
|
|
I agree with you from a language design standpoint, but seriously, I doubt you have much Ruby experience if you're saying this. And if that's the case, you really don't have a basis to be commenting on my book in such a critical and dismissive way. Using positional arguments for more than two or so things creates connascence of position, which quickly becomes annoying. Using block based DSLs so that you can break things down into small functions that each do their part is a good way around this, but these tend to be hard to extend dynamically. Typically well designed Ruby systems provide both: Pseudo keyword arguments for dynamic needs, and some DSL-type syntax for pleasing the eyes. Yes, it sucks that we don't have real keyword arguments. But no, it's not nearly as bad as you think. |
|
positional arguments for more than two or so things creates connascence of position
Which is precisely the reason that you shouldn't pass more than two arguments to a method (unless you are creating a list or hash for their intended purpose). If you have more than two arguments to a method, it's a sign that you should reify them into an object.
Using block based DSLs so that you can break things down into small functions that each do their part is a good way around this
Why do people love making things complicated by misusing blocks. Just create an object and set slots on it. Blocks are best used for delaying computation, not setting up state.
I think that Zed Shaw's essay on the "Master" and the "Expert" is applicable here: http://www.zedshaw.com/essays/master_and_expert.html