jargon

Design patterns·Objects, messages and the principles

nothing declared a shared type anywhere, and the code worked because both objects happened to have the method.

Duck typing

Also calledduck type, if it quacks like a duck

Relying on an object having the right methods at runtime rather than on any declared type relationship. It is structural typing without the compiler: extremely convenient, and it moves the entire class of mismatch errors from build time to the moment that line of code is finally reached. Test coverage is what stands in for the type checker in a duck-typed codebase, which is why those communities tend to care about it more.

Commonly confused with