Today I Learned

Some of the things I've learned every day since Oct 10, 2016

125: Duck Typing

Duck typing is a term used to describe programming languages in which, when a method is called on an object, it’s never formally confirmed that the object is of a specific type acceptable as input to the method, just that the object has whatever properties are required to perform the needed operations. In other words, it isn’t formally checked what an object is but rather what it can do.

The name is a reference to the saying, “If it walks like a duck and quacks like a duck, then it’s a duck”, which echoes this same principle.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: