Monday, November 2, 2015

Duck-Typing

Dev Fam,

Here's something I just learned today - Duck Typing.

https://en.wikipedia.org/wiki/Duck_typing

The name of the concept refers to the duck test, attributed to James Whitcomb Riley, which may be phrased as follows:
When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.[1]
I can't believe I never heard of this. Of course, I think this may be from the rising of so many dynamic programming languages and its popular use nowadays.

I like this quote:
Criticisms around duck typing tend to be special cases of broader points of contention regarding dynamically typed versus statically typed programming language semantics.

Of course, if I'm programming with a statically typed language, then I'm not wasting time with this "duck-typing". I need to avoid assumptions and get straight to the point.

But, this is good to know. I encountered this while learning Ruby.

Peace,
G2

No comments:

Post a Comment