NEW: English for Tech Bundle → Save 40%
Your progress

Loading your progress…

Home
Code & Deliverynoun · /dʌk ˈtaɪpɪŋ/

duck typing

In simple English

Duck typing is a core concept in dynamically-typed languages like Python, Ruby, and JavaScript. Instead of checking an object's type explicitly, you check whether it can perform the actions you need. For example, in Python, you do not need to declare that an object is a File-like object; if it has read() and write() methods, you can use it as one. In a tech workplace, you might hear this term during code reviews when discussing polymorphism or flexible APIs. Developers use duck typing to write more generic, reusable code that works with any object that has the right behavior, not just a specific class. This reduces coupling and makes systems easier to extend. However, duck typing also requires careful testing and clear documentation because type errors only appear at runtime, not when the code is written. This is why some teams pair duck typing with type hints (in Python) or TypeScript to catch errors earlier.

Understand what duck typing is and how it works in dynamic programming languages.

At a glanceCEFR C1
Commonness3/5
Versatility3/5
FormalityCasualFormalNeutral
Spoken ↔ WrittenSpokenWrittenBoth
Directness ↔ DiplomaticDirectDiplomaticDirect
RegionUS and UK
New app · Free lessons

Speak up in meetings. Feel confident.

Standup vocabulary, native examples, and quick practice — 100+ free lessons

Start learning freeNo card needed · Google or email

Say it like this

If it walks like a duck and quacks like a duck, then it is a duck
We are relying on duck typing here
This code takes advantage of duck typing

Real examples

in a code review

"The function works with any object that has a send() method, thanks to duck typing."

in a team meeting

"We can use duck typing to accept different database adapters without explicit type checks."

in a standup

"I refactored the logger to use duck typing so it works with any object that has a write() method."

Don't say this

Handle with care. Do not confuse duck typing with static type checking. Duck typing is about runtime behavior, not compile-time declarations. Also, it is a programming paradigm, not a debugging technique.

Duck typing is when you check the type of an object with isinstance().
Duck typing is when you do not check the type, but instead rely on the object having the right methods.Duck typing avoids type checks. Using isinstance() defeats the purpose of duck typing.
We need to add type annotations to use duck typing.
Duck typing works best without type annotations, though you can add them for documentation.Duck typing is a feature of dynamically-typed languages; type annotations are optional and used for clarity, not enforcement.
Duck typing only works in Python.
Duck typing is a pattern used in Python, Ruby, JavaScript, and other dynamic languages.Duck typing is a general programming concept, not specific to one language.

Other forms

noun

duck typing

"Duck typing allows us to write flexible code."

adjective

duck-typed

"This is a duck-typed function that accepts any object with a run() method."

Often used with

rely on duck typingto depend on duck typing for flexibility
duck typing approacha design strategy using duck typing
enable duck typingto allow or support duck typing in code
duck typing violationwhen code breaks the duck typing pattern by checking types explicitly

Similar words

structural subtypinga formal term for duck typing; based on object structure rather than inheritance
protocolin Python, a protocol defines a duck-typing interface without inheritance
polymorphismbroader concept; duck typing is one way to achieve polymorphism

Opposites

static typingnominal typingtype checking

Practice

Try it

4 quick exercises

Complete the sentence

1. Our API uses _______ so it accepts any object with a submit() method.

Spot the mistake

2. Which sentence uses duck typing incorrectly?

Pick the most natural phrasing

3. Your colleague asks about your design pattern. What do you say?

Rewrite naturally

4. Rewrite using duck typing: The function needs to know what class the object is before it can use it.

Questions

Quick poll

Have you said "duck typing" in a standup this week?

Want more structured practice like this? Our English for Programmers course covers real workplace English in depth.

Your badges