Meet Duck Typer: your new duck typing friend

27-Mar-2026 277
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.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle