Ducks

26 May 2017

Ducks

Python popularised the term “duck typing”; if it looks like a duck, and quacks like a duck, it’s a duck.

C++ is similar, with the caveat that it had damn well better actually be a duck or everything will explode and you’ll get an error message that won’t fit in your terminal’s scrollback.

C works on the assumption that you probably have your reasons for asking a fire hydrant to quack, and doesn’t want to say anything in case it looks stupid.

In Tcl, it’s a duck. Everything is a duck. If you want something other than a duck, make it yourself by taping a bunch of ducks together.

In Java, you spend three days poring over the documentation to try and figure out how to get hold of an instance of something that implements AbstractWaterfowlFactoryManager, then give up and reimplement the whole avian kingdom from scratch based on a version of dinosaurs that you hacked together in college.

JavaScript has no built in concept of “duck”, but there are dozens of ducks to choose from in NPM. All have several hundred dependencies, aren’t documented, and don’t appear to be actively maintained.

Haskell does have ducks, but they’re so 2011. You should totally rewrite everything using Mallard, which is basically the same thing, but better for some reason.

That’s my lot for now, but feel free to send me any more that fit the bill.

This site is maintained by me, Rob Hague. The opinions here are my own, and not those of my employer or anyone else. You can mail me at rob@rho.org.uk, and I'm @robhague@mas.to on Mastodon and robhague on Twitter. The site has a full-text RSS feed if you're so inclined.

Body text is set in Georgia or the nearest equivalent. Headings and other non-body text is set in Cooper Hewitt Light. The latter is © 2014 Cooper Hewitt Smithsonian Design Museum, and used under the SIL Open Font License.

All content © Rob Hague 2002-2024, except where otherwise noted.