2 ms·
I think the problem is that, yeah, they're messages but very low level messages about the state of the object and not at all about a behaviour of the object in
by jwdunne 9y ago
I think the problem is that, yeah, they're messages but very low level messages about the state of the object and not at all about a behaviour of the object in response to a message.
I think, however, they're a good way of building objects where a language lacks object or hashmap shorthand (e.g JS and Ruby). In fact, with Obj-C, if my memory serves right, it can look just as expressive.
Setters (particularly fluent), in that case, seem best for building objects in a readable way where a language lacks a way to pass express keyword arguments.
- lacampbell 9y agoI think in those examples, there are probably smaller objects hiding inside your bigger objects, and you should construct them first. FYI ruby has named arguments since a few versions back.
- jwdunne 9y agoI think you're probably right. That's the ideal. Thanks for letting me know - can't believe I missed that. I don't use Ruby professionally, just as a scripting language to make my life at work easier.