|
|
|
|
|
by richcollins
5933 days ago
|
|
Keyword arguments via hashes is certainly not a best practice for "Beautiful API Design". Sending messages is part and parcel to good OO design. Code that deconstructs hashes to emulate keyword arguments is invariably hideously complicated. |
|
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.