The Fencepost Problem

If there’s anything I’ve noticed that plagues many less-experienced programmers, it’s what I refer to as the fencepost problem (or fencepost error, if you will). The problem can be most succinctly summed up using this thought exercise: Imagine a fence that is 100 meters long. A fencepost is needed every 10 meters. How many fenceposts are needed?

The answer is, of course, 11. See the image:

Notice that there are 10 sections of fence, but there are 11 fenceposts. This error is a more specific case of the infamous off-by-one error that occurs in coding in general.

Why am I bringing this up? Because major software writers get this wrong all the time. Consider the following picture:

This screenshot is from Doodle.com, supposedly the most popular scheduling application in the world. Let us assume that I actually did check off 6PM as shown in the picture. Do you know how much free time that denotes?

None.

The problem is that 6PM is a fencepost, and time availability is “sections of fence,” ranges of time. A single fencepost sticking in the ground doesn’t denote any length; a second post is needed. The problem is that the visualization on Doodle has switched the fences and the fenceposts. Notice how the hours are marked by blocks, and time between the hours is denoted by a white border. The result: I have to color in two blocks to indicate that I’m available for one hour, and coloring in one block means squat.

Ridiculous.

But wait, there’s more! Now, imagine for a moment that one person’s availability was from 5PM to 7PM, and another’s was from 7PM to 9PM. What would that visualization look like?

Argh. Now try to imagine for a moment that I’m trying to schedule a meeting with 12 people (and um, is longer than 59 seconds), and they all enter their crazy, ridiculous schedules into Doodle, and I have to deal with sorting out overlaps that aren’t overlaps because they start and end at the same hour, but look like overlaps and … ugh, are you listening, Doodle?

Let’s move on to whenisgood.net:

As a writer of scheduling software, this irks me. The engineers can’t seem to let go of the fact that the hour markings have to take up more room than the time between the hour markings. Luckily enough for me, Google Calendar does not succumb to this problem.

I guess that’s why those engineers get paid the big bucks.

Related posts

Published by

Peter Cai

Peter is an engineer at Privy, an early-stage startup in Boston. Previously, he was an engineer at Microsoft, an early employee at Localocracy, and an engineer lead at the University of Massachusetts.

One thought on “The Fencepost Problem”

  1. Hi Peter

    Yes, Doodle is listening.

    There seems to be a major misunderstanding, though. That is, we may have a usability problem, but it’s not the fencepost problem. The use case you describe is one that Doodle does not support, I’m afraid, and that seems to have given you the impression that we got it wrong.

    Basically, Doodle supports the following two uses cases:
    1. Finding a time slot among a given set of time slots as in http://doodle.com/u6krhev54bhashwh (in other words, two explicit fence posts per option)
    2. Finding a point in time as in http://doodle.com/axw2fbuwu7smibh4 (in other words, the first fence post; the second being clear from the context)

    Best regards,
    Paul

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>