jack: (Default)
[personal profile] jack
I like the principle of duck typing.

Roast it if it looks sufficiently duck-like. Don't worry about whether it's officially a duck, just if it has the relevant features for roasting.

However, I don't understand the attachment to getting 3/4 of the way through the basting, stuffing and roasting project before suddenly discovering that you're trying to crisp a small piece of vaguely duck-shaped ornamental stonemasonry.

I agree with (often) only testing for the *relevant* features of duck-ness. But it seems like the best time to test for those relevant features is "as soon as possible", not "shut your eyes, and charge ahead until you fail". Is there a good reason for "fail fast, except for syntax errors, those we should wait to crash until we're actually trying to execute them"?

I've been working on my non-vegetarian metaphors, how did I do? :)

Date: 2017-02-17 04:51 pm (UTC)
redbird: closeup of me drinking tea (Default)
From: [personal profile] redbird
The metaphor is delightful, though I don't know how well it maps from a roast dinner onto software.

if it quacks...

Date: 2017-02-17 06:46 pm (UTC)
mair_in_grenderich: (Default)
From: [personal profile] mair_in_grenderich
you should make sure to test whether you have software or a roast dinner in plenty of time...

Date: 2017-02-18 07:44 pm (UTC)
fluffymormegil: @ (Default)
From: [personal profile] fluffymormegil
Point of order: duck-typing crashes are semantic errors, not syntax errors.

Date: 2017-02-18 07:45 pm (UTC)
andrewducker: (Default)
From: [personal profile] andrewducker
With any public API I write, the first thing it does is check that the inputs are actually valid. I'd have thought this would go especially with duck typing.