Duck Typing
As is my wont, I’d like to celebrate the combination of whimsy and insight that characterizes the best software development approaches.
Today’s exhibit comes from the programming language Ruby. Duck typing is a concept that is summarized in Chapter 23 of Dave Thomas’ excellent Programming Ruby: The Pragmatic Programmer’s Guide:
…the type of an object is defined more by what that object can do… If an object walks like a duck and talks like a duck, then the interpreter is happy to treat it as if it were a duck.
Non-programmers may find the exact meaning of that quote obscure, but hopefully you can appreciate the humor and common sense of looking at the currency of everyday code (integers and characters and files and arrays and other, more complicated elements) through the lens of the old “walks like a duck/talks like a duck” cliche.