In computer programming with object-oriented programming languages,
duck typing is a layer of programming language and design rules on top of typing. Typing is concerned with assigning a type to any object.
Duck typing is concerned with establishing the suitability of an object for some purpose. With normal typing, suitability is assumed to be determined by an object'
s type only. In
duck typing, an object'
s suitability is determined by the presence of certain methods and properties (with appropriate meaning), rather than the actual type of the object.
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. You are duck typing that bird :V