🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Duck Typing

In plain terms

Determining what an object can do by its methods, not its declared type.

Going deeper

Duck typing says if an object has the needed methods and properties, it can be used regardless of its class or inheritance. Common in dynamic languages, it favors behavior over formal type contracts.

Under the hood

Enables flexible, polymorphic code without interfaces, but errors surface at runtime rather than compile time; the name comes from "if it walks and quacks like a duck."

Examples

Python iterables, Ruby objects, JavaScript objects, anything with a .read() method treated as a file.

Think of it like...

Like hiring based on whether someone can actually do the job, not what their diploma says.

Feedback & Bug Report