4 ms·
I don't get it. If you're decorating, then ordering the decorators differently gets you different behaviour. It's exactly the same. Indeed, you could write a s
by twic 11y ago
I don't get it. If you're decorating, then ordering the decorators differently gets you different behaviour. It's exactly the same.
Indeed, you could write a straightforward mechanical method to convert any trait stacking into a decoration.
- jbooth 11y agoYeah -- I'm arguing for composition because it's harder to screw up, at the cost of being less pretty. The manner and order in which composed objects are delegated to is crystal clear if you're wiring them yourself (or with your IDE). I've seen some messy, confusing code involving traits and just slapping 'with Thingy' 10 times in a row. The phrase 'emergent behavior' is how I would best describe it.