3 ms·
Code can be clever to allow (significantly more) other code to be simple. For example, we are using Higher Order Messaging[1] to turn this: if ( [delegate
by mpweiher 10y ago
Code can be clever to allow (significantly more) other code to be simple.
For example, we are using Higher Order Messaging[1] to turn this:
if ( [delegate respondsToSelector:@selector(doSomethingElse:)]) {
[delegate doSomething:self];
}
into this:
[[delegate ifResponds] doSomething:self];
Yes, the implementation of -ifResponds is slightly clever, though I've gotten it simpler over time, but it certainly is worth it in the simplification of client code.
Engineers manage tradeoffs. That's what makes them engineers.
[1] https://en.wikipedia.org/wiki/Higher_order_message https://en.wikipedia.org/wiki/Higher_order_message