Duck Typing: In computer science,Duck TypingIs a form of dynamic type: the value of a variable implicitly determines the behavior of a variable. This implies that an object can be exchanged with other objects that implement the same interface, regardless of whether the object has an inheritance relationship.Duck TypingYesProgramming LanguageFeatures: smalltalk, Python, Ruby, and ColdFusion.
Duck TypingIs a duck test (DuckTest) A reference -- "if it walks like a duck, it must be called as a duck, then it must be a duck ".
Alex Martelli is considered the inventor of this term by posting information on the comp. Lang. Python newsgroup.
In smalltalk, any object can be exchanged with other objects at runtime. This is the most flexible dynamic type.Duck TypingTry to limit this flexibility to remove possible error sources before running. Smalltalk framework engineers are exploring for true polymorphism, and may introduce errors at runtime. In practice, these errors can be detected through the Sunit test at runtime.
Abstract data types are dynamic interfaces. They exist only in guarantee, paper, and specific interfaces. Smalltalk uses purely dynamic mechanisms to expand guarantee in practice in a changed way. This is as simple as the general "method not found" exception processor in the catch mechanism. But it can call extension languages or environments, such as strongtalk. Exception Handling in parallel with Smalltalk is called in Java and PythonDuck Typing, A single reason for syntax improvement.
The C ++ template implements a staticDuck Typing. For example, an iterator cannot inherit methods from a base class of an iterator.