Duck typing

/dʌk ˈtaɪpɪŋ/ noun

Definition

A programming concept where an object's suitability is determined by the presence of certain methods and properties, rather than the object's actual type.

Etymology

Named after the phrase 'If it walks like a duck and quacks like a duck, then it must be a duck.' The term was popularized by Python programmer Alex Martelli in 2000, though the concept existed earlier in dynamic languages.

Kelly Says

The name comes from 'if it walks like a duck and quacks like a duck, it's probably a duck' - your code doesn't care if something is officially a Duck class, just that it can walk() and quack()! This is why you can use a rubber duck in your bathtub simulation even though it's not a real duck.

Related Words

Explore More Words

Get the Word Orb API

Complete word intelligence in one call. Free tier — 50 lookups/day.