January 2018

S M T W T F S
  123456
78910111213
14151617181920
21222324252627
28293031   

Style Credit

Expand Cut Tags

No cut tags
Wednesday, August 22nd, 2007 11:43 am (UTC)
Not sure where to start with this. The whole point of duck typing is to enable the kind of code reuse you describe, without having to think about virtualising either the library or the calling code explicitly. With duck typing, you don't have to say "I no longer implement IScoobyGang but I do implement IPowerRangers" - remove the method, and it's done.

I understand the rationale behind explicit interfaces (you make a good point when you say "The calling code should check whether a given object implements a particular interface at runtime, and if not then it can handle that appropriately, rather than assuming that my code has a particular method and then crashing mid-function" - this can be done in dynamic languages, but it's a bit more of a faff), but for the kind of code I write, they're overkill. And I have a very low tolerance for writing unnecessary lines of code.

Reply

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting