More on bubble sort, and (separately) software architecture
Where we misunderstand an argument in favour of bubble sort, talk about types of abstraction in a collaborative card game implementation, and read some 1884 science!
Hello! Some of you may have already seen a draft of the second article in this newsletter. That's going to happen sometimes. Sorry!
New articles
Bubble Sort Is Not Robust Either
Baader–Meinhof strikes again: just as I published the previous article on bubble sort, I stumbled over someone claiming bubble sort is more robust than more efficient sorts. I misunderstood their claim and argued vigorously against it – that’s this article.
Full article (3–10 minute read): Bubble Sort Is Not Robust Either
Types as Interfaces
I started writing a collaborative card game in Haskell to evaluate how fun it would be to play (not very fun at all in its current form). In the process, I found myself using a type as an interface. Well, as someone commented on a draft of the article:
Is this something professional programmers are having trouble with?? This is the kind of problem you face in your first year working, no? I am honetly curious what others think. Do you have trouble deciding when to use an interface (assuming your language has that), or a type wrapper (I don't think that's the brightest idea), or a function to extract the field to sort by (most languages do that)??
With someone else responding
If you think "professional" programmers don't get this sort of thing wrong in some form or another, I have a bridge to sell you.
Full article (5–15 minute read): Types as Interfaces
Flashcard of the week
I don't remember where, but someone drew my attention to an 1884 article On Small Differences In Sensation. This article produced a discovery as a side effect, giving rise to the flashcard prompt:
Who showed humans express confidence in log–odds?
I had already suspected this to be the case, so I'm suffering from all kinds of confirmation biases in just assuming the 1884 article got this right. Anyway, the answer is
Peirce and Jastrow.
At the time the article was published, there was a popular hypothesis that human senses had a lower threshold, beyond which differences can no longer be perceived. Peirce and Jastrow dispense of this hypothesis through an extremely careful experimental setup, where they attempt to judge differences in pressures placed on their fingertips. They find no threshold – it's a smooth function of discriminatory ability all the way down.
However, to get more vivid data, they also recorded their confidence in their reported difference sensation on a numeric scale from 0 (meaning "wild guess") to 3 (meaning "virtual certainty").
They noticed that this confidence indication was roughly proportional to log[p/(1-p)], where p was the probability of guessing correctly. Isn't that kind of cool? This was essentially what I was aiming for in the sidenote where I suggested switching to a different propensity scale to treat (some) overconfidence.
(Something else interesting about their experiment was that even when they indicate zero confidence, they are right slightly more often than not. They suggest that maybe somehow the body is capable of detecting finer differences than are surfaced at the level of conscious expression.)
Your opinions
As always, I cannot improve without feedback. Reply to this email to share your thoughts on any of the topics above, or anything else!