Meet Duck Typer: your new duck typing friend

27-Mar-2026 280
The Ruby language leans on duck typing rather than formal interfaces. “If it walks like a duck and quacks like a duck, it’s a duck.” bodies = [poem, essay, case_study, user_manual].map(&:body) These objects come from different classes but all respond to body, so you can treat them uniformly. That’s informal polymorphism: no type annotations, no ceremony. Duck typing is great, but what I miss is enforcement. If one class implements a method and another forgets to, I want something to complain.

Free eBook download

Download all our eBooks for free from Gumroad!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these books offer thousands of essential questions and answers across multiple languages. Download the complete collection for free from our Gumroad page. Free Ultimate Job Interview Preparation eBook collection