Timeline for Are design patterns independent of programming languages?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 25, 2012 at 6:44 | comment | added | danyowdee | “conformsToProtocol: only works on types that have declared that they implement that protocol” Actually, that’s incorrect with the prime counter-example being proxies: In those you forward such decisions to their target(s), so that the response to that message isn’t even dependent on the receiver’s type… While respondsToSelector: is more granular, that granularity comes at the cost of clutter. In many real-world scenarios you’d need to mix and match both anyways because of optional methods in the protocol. But if the protocol is yours, why not enforce it? That was my line of argument. | |
| May 25, 2012 at 0:40 | comment | added | user102008 | "Replacing multiple respondsToSelector: methods with a single conformsToProtocol: is a win." You can't just replace respondsToSelector: with conformsToProtocol:. respondsToSelector: works for any type that implements those selectors. conformsToProtocol: only works on types that have declared that they implement that protocol | |
| Dec 26, 2011 at 17:46 | comment | added | Amogh Talpallikar | hmmm right...Totally Got ur point. | |
| Dec 26, 2011 at 14:09 | history | migrated | from stackoverflow.com (revisions) | ||
| Dec 26, 2011 at 13:59 | comment | added | danyowdee | I honestly don't understand what you mean and what the existence of primitives has to do with it. My point was: Just because you can use duck-typing doesn't mean you always should. It's a matter of keeping things simple, predictable and thus understandable. Static typing can help here, so make use of it where it makes sense. Make use of the dynamism where that makes sense: façades/proxies, mocks — this is where it really shines! | |
| Dec 26, 2011 at 13:34 | vote | accept | CommunityBot | ||
| Dec 26, 2011 at 13:34 | comment | added | Amogh Talpallikar | Thanks .. thats what I wanted. but then how will Obj-C have benefit over say Java. both are mixtures of objects and primitives. n Obj-C is dynamic and we cant as such leverage the benefit of it. | |
| Dec 26, 2011 at 13:29 | history | answered | danyowdee | CC BY-SA 3.0 |