Duck typing
|
Duck typing is a humorous way of describing the type non-checking system typical of some programming languages where, as with Smalltalk, the variable value itself determines what it can do. The name combines two metaphors, both to make a serious point, and to make a joke.
One could say that the language "ducks" the issue of typing. Initially coined by Dave Thomas in the Ruby community, its premise is that (referring to a value) "if it walks like a duck, and talks like a duck, then it is a duck". Duck typing also refers to the concept in some languages that as long as an object implements a certain interface, it is interchangeable with any other object that implements the same interface, no matter whether the two have a related inheritance hierarchy.