Sunday, 29 September 2013

Sainsburys self-checkouts and lazy UI design

So, I know it's almost a cliche to complain about the self-checkout machines in supermarkets, but I generally find them incredibly efficient. I'm going to try and write this entire post (which won't be very long) without mentioning "unexpected items" at all. 

As I said, I usually find the process very efficient - at our local Tesco, it means one staff member can be serving about 15 customers at one time, and I very rarely have any major issues, although I guess I am younger and more tech-savvy than the average person, so it's possible there are some features that I just sort of take for granted which are in fact confusing. There's an interesting article at coding horror on this. However, there is one feature of the Sainsbury's version of this machine which I find extremely annoying. 

When you have scanned all your shopping, and pressed the button which takes you to the payment screen, if you insert your card into the card reader, you get this message.


As you can see, this message annoys me enough that i took a photograph of it. In case that's not legible, it says "Please press the card button". Now, I know for most people reading this it will be immediately obvious why this is terrible, so please excuse me while I rant for a moment:

The machine knows that I entered my card into the card reader. It knows that every time anyone ever enters their card into the card reader, they should have pressed the card button first. So why the hell doesn't it "press the card button" for me? 

I really only think of one plausible explanation - the way the person writing this software had implemented the "card button", it was much easier to put in this intermediate screen and have the user go back and physically press the button than it would have been to automate the process. I can think of no possible good reason. (I can actually think of one other bad reason to do this - it was somehow part of whatever specification the developers were working from that people had to explicitly push the card button to pay by card - but that just pushes the incompetence up a level). 

As evidence that there is no good reason, the machines at Tesco do display the sensible behaviour - if you insert your card once you'e gotten to the payment screen, they behave in exactly the same way as if you'd pressed the card button first. 

Now, assuming my laziness explanation is correct, this is really, really lazy. This is the sort of lazy that I probably wouldn't try to get away with if I were writing an Excel macro to be used by half a dozen people in my office. How on Earth did someone get away with it when writing software to be used by the general public, for one of the biggest retailers in the country? Perhaps the World is Mad after all (incidentally that is a reference to a future post that I haven't written yet, maybe it will work as some sort of commitment device...).

Thursday, 19 September 2013

The first 100 hours

So, I recently read The First 20 Hours, by Josh Kaufman. This books is very weird, in that it basically seems to consist of Josh Kaufman coming up with one pretty interesting idea, which can be written in about two sentences, or at most two paragraphs, and then trying to figure out a way to spin it out into an entire book.

The idea, basically, is that you will get surprisingly good at things surprisingly quickly if you just commit to practising them on a regular basis for a reasonable amount of time, and if this practice is sensibly directed. These ideas are amply summarised, along with several anecdotes, in the first 39 pages of the book, (which, incidentally, is in large type). In fact, the enormous majority of it is summarised in these 10 tips: 
  1. Choose a lovable project.
  2. Focus your energy on one skill at a time.
  3. Define your target performance level.
  4. Deconstruct the skill into subskills.
  5. Obtain critical tools.
  6. Eliminate barriers to practice.
  7. Make dedicated time for practice.
  8. Create fast feedback loops.
  9. Practice by the clock in short bursts.
  10. Emphasize quantity and speed
And yes, I agree, most of these are pretty obvious: I mean "obtain critical tools"? Here's me thinking I could learn to play the guitar with just a piece of string and some chewing gum...

The rest of the book is 5 examples of Kaufman applying his methods - he learns to play Go to a not-totally-terrible standard, buys a yoga mat (this is almost literally accurate - he "learns" yoga in a total of 3 hours practice, incidentally, his wife is a yoga instructor...). builds a simple website, learns to play the ukulele from scratch, and learns to windsurf.

Of these, the only one that is actually impressive is the ukulele - he goes form nothing to playing in front of a fairly large audience in literally a week which, while it is obviously possible when you stop to think about it, sounds exceedingly daunting the first time you hear it.

Anyway, pretty much the most important sentence in the book is one which I don't think is even in the book (I mostly skimmed it), but is certainly in his TEDx talk.
The major barrier to learning something new is not intellectual... it's emotional... feeling stupid doesn't feel good.
I'm not even entirely convinced that it's fear of feeling stupid. It's just easier to sit and watch TV than it is to pick up the guitar and play some terrible approximation of Au Clair de la Lune (because you haven't even started to learn tunes that you actually want to be able to know how to play), or try to figure out how to install an API so you can write your first Android app, or drop juggling balls all over the floor. I think the key idea in the book is that you should commit to spending 20 hours learning something (and admit that it's ok to be terrible at it for a good portion of those 20 hours), and just see how far that takes you.

So, anyway, I've decided to learn some new things. 20 hours a month is 40 minutes a day (which is conveniently just about the time I have left for myself if I come home in my lunch hour). I have decided to spend 100 hours over the next 6 months (allowing for the days when I don't get round to practising, etc) learning 5 new skills. I'll be keeping track of the time carefully (principles 7 and 9, I think).

I haven't yet decided what the 5 new skills are, but I think the first one will be playing the guitar. I bought a toy guitar from John Lewis a few months ago, and haven't played it at all because I can't tune it. When I recently got a new phone, on which the tuning apps actually work, it became much more appealing (obtain critical tools; remove barriers to practice). On the principle that generalists ship, and even though I'm very clearly in the dabbler phase right now. I'll try to record a video, or at least an audio recording of me playing something when I get to my 20 hours, and I'll post that, along with an update on what the next skill is going to be.

Friday, 13 September 2013

A return to blogging (for a while)

When I was in California a couple of years ago, Michael Vassar said something to me that pretty neatly summed up some vague thoughts I'd been having myself. Describing my existing blog (which has since gone on hiatus), he said that the majority of it was "like shooting fish in a barrel", and he's right. Most of my blog posts are about how crazy homeopathy is (shocking!) or how some immigration is probably a good idea, or nuclear power just isn't that dangerous. Now, some of these ideas might be part of the correct contrarian cluster, but most of them aren't even that - certainly not among the people I usually mix with. Most of them are part of the correct non-contrarian cluster. Pretty much everyone I know would agree with pretty much everything I've ever written on this blog. I've no idea if I should consider that a bad thing. I've been considering starting writing posts regularly again for a while, and haven't for three main reasons. One of them is that I expect that for a while, the posts would end up being navel-gazing rambles about why I haven't been blogging for a while*.  The second is that I was looking for work in relatively mundane professions, so was being fairly careful about my web presence. I'm now pretty settled in in my current job, and hopefully next time I'm looking for work, it will be somewhere where an interesting web presence is a bonus, rather than a hindrance. The third is that I'm just not sure that I'm right about as many things as I was sure about even two years ago, and I'm even less sure that the things I'm sure I'm right about are the areas where my ideas are interesting/entertaining/important. A few of the posts I'll write over the coming weeks will touch on this theme, but don't worry, I'm sure there'll still be some shooting of fish a barrel.

Anyway, to avoid this turning into a seriously long rambling introspection, I'm going to stop there, and commit (semi) publicly to writing at least one blog post a week until the end of the year. Hopefully at least one or two people still check in here every now and then, and if I do manage to keep up one a week, I'll probably start telling people about some of them. Also, bizarrely, I've still been getting 15+ hits a day even though I haven't been writing anything for about two years - Google is powerful!

* On this note, and to avoid saying it elsewhere - I was genuinely surprised by the number of people who noticed when I stopped posting a couple of years ago - come on people, how do I know you're reading this if you don't tell me until I stop writing it?

Sunday, 18 November 2012

CJ Cregg and the Intermediate Value Theorem

I have started watching the West Wing all the way through, and just got to an episode entitled 'Evidence of things not seen', in which one of the subplots is CJ claiming that it is possible to balance an egg on its end only at the Equinox. The rest of the President's staff is reassuringly dismissive of this idea. CJ is the gullible one (she was shocked to discover that the Mercator projection is not the only way to draw a flat map of the Earth). However, they were wrong in thinking that this feat is never achievable (to be fair, I'm not sure if that Snopes page was written when that episode of the West Wing came out). However, that was not the bit that was interesting to me. There was another thing CJ said of which the staff was equally dismissive. She said:
There's a point on the Earth where the temperature is exactly the same as the temperature at point you'd get to if you drilled right through.
CJ was laughed at for this claim. Will Bailey's immediate response was "no there isn't". My immediate response was "that sounds eminently plausible". Perhaps that's why I have a degree in maths and Will Bailey is a fictional character with a degree in law.

Now, I'm guessing that this is also eminently plausible to the majority of people reading this, as I'm guessing the majority of people reading this also have maths degrees. However, I'm going to expand a little, and mention in passing a few other somewhat surprising facts which are true for exactly the same reason. That reason is something called the Intermediate Value Theorem.

The intermediate value theorem states that for any value between the minimum and maximum value of a continuous function, there is some point where the function takes that value (a continuous function is, basically, one that doesn't jump around - a slightly more formal definition (in fact, a very good approximation to the actual formal definition) is 'a function where small changes in the inputs result in small changes in the outputs')).

 It's one of those theorems that is insanely obvious, but mathematicians like to prove anyway (not to quite the same extent as the Jordan Curve Theorem, but still). The intuition for the theorem is very powerful. Basically, it says that if you start here, and walk to somewhere that's 100m away from here, then at some point you were exactly 50m away from here. Obvious, but powerful... Now, draw a circle around the Earth, and consider any continuous function which takes a value above zero somewhere on the circle, and a value below zero somewhere else on the circle. This function must take the value zero somewhere on the circle. 

Now to prove CJ's Antipodean Theorem, just consider the function 'the temperature here minus the temperature at the point directly opposite here on the surface of the Earth'. This is pretty obviously continuous (to a good approximation) - temperatures don't just suddenly jump as you move a few centimetres around the Earth, and it's pretty obviously higher than zero at some point on the Earth and lower than zero at some other point on the Earth (just pick any two points which are opposite each other and have *different* temperatures). QED. Note that this proves not only that there is a point somewhere on the Earth with this property, but also that there's a point *on every single great circle around the Earth* with this property.

There are several other fun real-world applications of the intermediate value theorem. For example, there's the wobbly table: if you have a well-made table, then you can always balance it somewhere on any surface, however uneven. The Ham Sandwich Theorem: If you place a piece of ham on a slice of bread, there's always one vertical cut which will divide both the ham and the bread exactly in two. There's also the Beer Glass Balance trick, which I've always thought of as vaguely related to the IVT, but never quite figured out why.

Incidentally, it's actually quite easy to balance an egg on its end - although it has nothing whatever to do with the equinox. Don't believe me? Try it.

Monday, 7 March 2011

In Defence of Impossible Precision

John Allen Paulos has quite a good column on innumeracy, first he asks readers to assess the following headlines:
1. After the Packers' Super Bowl victory, an exuberant Aaron Rogers Shook Hands with Everyone in the Stadium.

2. Experts Fear Total US Housing Costs (Rents plus Mortgage Payments) Will Top $2 Billion in 2011.

3. Only by Completely Eliminating Foreign Aid Can We Eliminate the Deficit.

What is wrong with them? Well, I don't expect anyone reading this not to have noticed that shaking 40,000 hands would take at least 10 hours, that $2 billion comes to about $10 per person or that Foreign Aid is such a tiny portion of the US deficit that even eliminating it entirely wouldn't make a big dent (this doesn't, of course, mean that it shouldn't be eliminated, only that if you're obsessed with the deficit, you have bigger fish to fry).

He then moves onto the following headline:
4. Number of Americans with Alzheimer's Believed to Be 5,451,213.
The supposed problem?
4. The problem here is that the number is ridiculously precise. Definitions of Alzheimer's vary and it's difficult to determine whether a single individual is suffering from it, much less whether five million plus are. Such impossible precision is common.
Well, yes, the number is ridiculously precise. No, no-one does think that we can measure the number of Americans with Alzheimer's to that degree of accuracy, but so what? If you do a survey of Americans, do some calculations, and your best estimate of the number of Americans with Alzheimer's comes out as 5,451,213, what number, exactly, does Paulos want you to report?

Assuming that you've done your sums correctly, 5,451,213 is an unbiased estimator of the number of Americans with Alzheimer's. Rounding your guess to 5.5 million does systematically worse than just reporting the estimator you got out of your calculations, so what exactly is the rationale behind it?

Yes, numbers like this should probably be reported along with some estimate of variance, and maybe it's a convention that we assume the number of signficant figures of a number to be a proxy for the size of its error bars, but it doesn't have to be that way: I look forward to a day when numbers like "5.5 million" get scoffed at by popular mathematics writers for being "overly round" or "not accurate enough".

Thursday, 3 March 2011

Why aren't all journals open access?

Here is the way the current system of academic publishing works, as far as I can tell: universities employ researchers who do original research, and produce journal papers; universities employ researchers who do peer-review, and make sure journal papers are up to standard; journals employ editors, who put the content together, and organise the referees; universities pay large amounts of money to journals in order to be allowed to read the articles.

Now, as you can see all of the money in the system comes from the universities. Universities pay the wages of the researchers and the reviewers directly, and they pay the wages of the editors indirectly (through journal subscriptions). So, here's an idea; why don't the universities club together to buy the journals, employ the editors directly, and publish all the content for free?

Note that buying the journals doesn't cost the universities (as a group) anything in the long-run, as the entire current value of the journal companies comes from the amount of money they expect to be paid in journal subscriptions by universities in the future. And there's no need for the journals to charge "submission fees", as those were all being paid by the universities in the first place: they can just come out of the communal pot.

So far as I can see, there is literally no downside to this - assuming coordination can be achieved, you have the same universities paying the same amount of money to the same people to produce the same articles, but the articles are now all available open-access. I admit that "assuming coordination can be achieved" is a fairly hefty assumption, but given the massive upsides, why isn't anyone at least suggesting this sort of approach?

There seems to be a general trend towards open-access publishing anyway, which is a Good Thing, but I don't undestand why this model isn't a strict Pareto improvement on the current system.

Tuesday, 15 February 2011

What should be in a maths class?

I have recently (well, in the past two years) read two very interesting essays on the teaching of mathematics. At first glance, they seem to be almost diametrically opposed, but I tend to find myself agreeing, overall, with the thrust of both. The essays are Paul Lockhart's A Mathematician's Lament and Conrad Wolfram's TED talk on mathematical education. A couple of quotes from each which provide a brief summary.

From Wolfram's talk (trancript available here):
I want to see a completely renewed, changed math curriculum built from the ground up, based on computers being being there, computers that are now ubiquitous almost. calculating machines are everywhere and will be completely everywhere in a small number of years. Now I'm not even sure if we should brand the subject as math, but what I am sure is it's the mainstream subject of the future.
From Lockhart's Lament:
The art is not in the “truth” but in the explanation, the argument. It is the argument itself which gives the truth its context, and determines what is really being said and meant. Mathematics is the art of explanation. If you deny students the opportunity to engage in this activity— to pose their own problems, make their own conjectures and discoveries, to be wrong, to be creatively frustrated, to have an inspiration, and to cobble together their own explanations and proofs— you deny them mathematics itself. So no, I’m not complaining about the presence of facts and formulas in our mathematics classes, I’m complaining about the lack of mathematics in our mathematics classes.
So, Lockhart thinks we should be teaching mathematics as an art form, and Wolfram thinks we should be introducing more computers into mathematics lessons so that people can concentrate on doing the bits that are actually useful. Which of them is right? Well... both, but mostly Wolfram.

The question we have to ask ourselves before we can even begin to compare the two essays is why do we teach mathematics at all? So far as I can see, the only sensible justification for having mathematics as a subject that everyone in the world should be taught up to a relatively high level is because it's useful. You can't do physics, or engineering, or any sort of science, or do derivatives trading, or even decide which mortgage to get, without knowing quite a lot of mathematics. For this reason, everyone should be taught the basic mathematics that they need to know in order to do these things (or the basics they need to know in order to learn the specific maths they wnat to use).

Note that one corollary of this mode of thinking is that most of the mathematics you learn probably shouldn't be taught in a maths class. It's much easier to learn how to get from acceleration to speed than it is to learn how to differentiate a function. Yes, it is useful to then point out the possible generalisations (getting from acceleration to speed is the same as getting from jerk to acceleration) but I don't see any reason why these topics can't be introduced concretely. I personally have serious trouble doing any calculus that I can't do using physical intuition, and I think it's fair to say that I am an above-average student when it comes to learning maths. Calculus should be taught when you're doing engineering, statistics should be taught when you're analysing the results of experiments, graph theory should be taught when you're trying to solve scheduling problems.

Lockhart, on the other hand, seems to think that we should be learning mathematics because, essentially, mathematics is awesome. I happen to agree with him that mathematics is an exceptionally beautiful art form. I'm happy to sit back and bask in the glory of Cantor's diagonalisation argument, or the ingenuity of Karp's reductions between NP problems, but I'm not sure that I'm willing to contend that everyone should be forced to. Yes, if you want to be a mathematician you have to learn that mathematics is actually an art, but most people who study mathematics don't want to be mathematicians, and most people who study mathematics *shouldn't* want to be mathematicians. For these people, learning about the art of mathematics is little more than an intellectual curiosity, on a par with learning about Titian or Shakespeare.

In other words, Lockhart is right, inasmuch as we want people to study mathematics for it's own sake. Wolfram is right, inasmuch as we want people to study mathematics because it's useful.

Now, I happen to tend strongly towards the idea that the only things we should be teaching in schools are things which are potentially useful, but that obviously isn't the prevailing wisdom - everyone in this country is still forced to do an English Literature GCSE. Lockhart-style mathematics is a perfectly good substitute for art class, or critical theory. Wolfram's mathematics is a necessary prerequisite for doing just about anything else.