YASB – Yet Another Symfony Blog

January 23, 2007

Fuzziness helps keep focus

Filed under: General, Tips and tricks — Krof Drakula @ 5:43 pm

Now, this may sound as an oxymoron in itself – how exactly does vagueness help keep the overall picture in focus? It’s been proven that the human brain can perceive information and filter it to effectively perceive the environment – just imagine each eye capturing something like 8-megapixels’ worth of data every 1/30th of a second and processing all that data into a spatial model that we can perceive. Generally speaking, even supercomputers today would croak if you’d ask them to do something even remotely as complex as that.

But, for the sake of clarity, let’s just see how the human brain operates – filtering starts very early on, before perceived light information reaches the optical nerve. There’s layers of neural tissue inside the retina that already filters information before it’s passed into the optic nerve, ignoring all but the most significant details in the big picture. And that’s not all, before we do process that information, the brain discards information that we’re not looking for – like a lawyer only mentioning facts relevant to the case (and his side). That’s why we tend to miss stuff we’re not familiar with.

But, what does this have to do with the case in point? Well, too much information can be overkill. Imagine a web application where you have multiple numbers, dates, timestamps, the lot. This is a very precise method of displaying data, but to us, processing it takes time. How many times have you asked yourself, “just what day was the 22nd? Was it Thursday?” The list goes on, familiar things display in an unfamiliar fashion.

So, if there’s not a crucial need for accuracy, why not discard the unnecessary details? Why not just say “posted 2 days ago” instead of “posted on Jan 13 2007 at 13:34:17?” Certainly makes a whole lot more sense – we live in the now, and it’s far more easier for us to imagine the timescale that way. And also, as a rule of thumb, we tend to only look one accuracy level down when judging decimal or any fractional number. Example:

two and a half hours is pretty much sensible, whereas ten and a half hours isn’t as much (sure, when we’re talking about precision-crucial information, we need more precision, but for the general part, we don’t really think like that).

We pretty much try to even out on the largest commonly used unit of measure when we express data. We don’t really say one day and three hours ago since the three hours really don’t matter much… if we wanted to say that amount exactly, we’d just say 27 hours.

You can take advantage of this by using a class that processes time intervals and other measurements and turns them into fuzzy parameters. Take dates, for example. You could write a function that returns one of the following:

  • n years ago
  • n months ago
  • n weeks ago
  • n days ago
  • yesterday
  • n hours ago
  • just now
  • in n hours
  • tomorrow
  • in n days
  • in n weeks
  • in n months
  • in n years

Judging when to use certain units is up to you – you need to decide just how much accuracy is needed. For example, to decide whether to use tomorrow or in n hours, you could say, “if tomorrow comes in less than half a day, return tomorrow, else in n hours“. Similarly goes for days – if next month is more than one half of a month’s days ahead, display in n days, else next month.

And the logic goes on. Take a look at Last.FM, for example. If you’re registered and take a look at your dashboard, all the time intervals will be relative to the current time and in fuzzy mode.

A nice way to make your application user friendly and give it a more organic feel to the user experience.


  1. There’s a function called distance_of_time_in_words() in DateHelper which does pretty much that.

    Comment by Mike Nolan — January 23, 2007 @ 7:20 pm

  2. True, but having a look at it it’s missing some of the features I described in the post, like saying “yesterday,” or “next month.” It may well be my nit-picking nature, but just had to say it. ;)

    Also, something I’ve noticed with Last.FM, it tends to be more humanly expressive when it comes to referring to day names – when the interval is less than one week, for example, it tends to say “last Friday night” or something similar.

    Comment by Krof Drakula — January 24, 2007 @ 11:58 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress