This page has moved. Update your links to: http://www.nedbatchelder.com/blog/200204.html

[*]
Ned Batchelder
April 2002
» Home : Weblog

Bagel Abattoir

Saturday 20 April 2002 (¤)

I was in the Finagle A Bagel in Needham, and while I was waiting to place my order, I noticed a conveyer belt built into the display case.  It was about six inches wide, and ran the entire length of the counter.  It was moving pretty fast, and in the middle of it was a foot-wide horizontal disk spinning really fast.  When my turn came, I asked what the conveyer belt was for.  The bagel guy said, "Watch", picked up a bagel with his tongs, and tossed it onto the belt.

The bagel was zipped along to the disk, which sliced it neatly in two, and sped it faster along the rest of the belt, like one of those Hot Wheels thingies with the two wheels inside that spits the car out the other side.

I was amazed. This was more than a bagel slicer. This was a finely honed bagel-slicing machine. This was a bagel abattoir.

It seemed a little excessive, but then I thought about it: bagel slicing is a hard thing to do safely, and it takes time. When the store is busiest, slicing the bagel could be a significant fraction of the time it takes to serve a customer, and is clearly the most dangerous part. The pressure to serve the customers faster only make manual slicing more dangerous. With this bagel slicer, Finagle A Bagel has decreased the amount of time it takes to serve a customer, greatly reduced the risk of injuries for their workers, and created an attraction in the store, all at once. Hooray for the bagel abattoir!

(react)

How To Draw A Monkey

Saturday 20 April 2002 (¤)

My youngest son is fascinated by drawing, and will sit with a box of crayons and a stack of paper for hours, drawing all sorts of things (pirate ships are a favorite). He'll ask me to draw things for him as well, and I try to draw what he asks for. Last weekend he asked me to draw a monkey. I said, "OK, I'll draw a monkey", but I found that I could not. I asked my wife, "Hey, how do you draw a monkey?" She wasn't sure. We researched it (Things That Go, by Anne Rockwell, was particularly helpful!), tweaked it, polished it, and this is what we ended up with (executed in Crayola brown on Staples brand multi-purpose paper):

simple hand-drawn monkey

(react)

Building Cathedrals

Friday 19 April 2002 (¤)

Caterina recounts a story of two bricklayers. I like it. Try to think about building cathedrals rather than laying bricks.

(react)

(via: caterina.net)

Method of Swinging on a Swing

Monday 15 April 2002 (¤)

We've all seen stupid patents. Things that should never have been filed, much less granted. Now we have patent #6368227: Method of swinging on a swing. Now, come on. Surely this is a joke of some sort, although the Patent Office wasn't clever enough to get it.

I can just see this guy prowling the playgrounds, trying to get license nickels off of kids swinging side-to-side.

(react)

(via: fishfaced)

Oddpost email

Saturday 13 April 2002 (¤)

From the looks of it, Oddpost is a very slick web-based email system. They've implemented a clone of Outlook Express in DHTML, and it works remarkably smoothly. I haven't signed up for my own account to try it out, but I'm thinking about it.

I use Yahoo mail, but they have been continuing their descent into desperation. In addition to their recent sleazy re-working of marketing preferences that included setting everything to "yes" (and not providing a "set all to No" button), now they are going to charge for POP3 access.

So, for $30/year (if I sign up immediately, only $20), I can use Yahoo's clumsy browser interface, and get advertising and spam. Or for $30/year, I can use Oddpost's drag-and-droppable, keyboard short-cuttable, advertising-less, POP3-able email. Hmmmm....

To be fair, I know that Yahoo has taken on a tougher coding problem, since they don't rely on IE5, as Oddpost does. But I only use IE5 and higher, so what do I care? As Nicholas Cage said in Moonstruck, "I'm no friggin' monument to justice!" And I know that Yahoo has a much better chance of being around a year from now than Oddpost does. But still...

(react)

(via: Codestore)

Code Should Only Do Nothing If Nothing Is The Correct Thing To Do.

Wednesday 10 April 2002 (¤)

This is on my mind, so I'll share: When writing code, if you want to leave a code path empty (for example, because it's a placeholder for more code to be written in the future, or because you think it isn't a case that can arise, or you just don't feel like writing it), don't leave it empty.

I'll state it differently, as a strict rule: Your code should only do nothing if nothing is the correct thing to do.

The reason is this: it is very hard to debug a problem if the root cause is that nothing happened a while back when something should have.

Rather than leave an empty code path, write an assert that expresses your intentions. For example, if you simply haven't written the code yet, then instead of this:

if (IsThisATrickyFutureCase()) {
    // todo: write some code...
}

do this:

if (IsThisATrickyFutureCase()) {
    // todo: write some code...
    ASSERT(FALSE, "Not yet implemented");
}

Now when the tricky future case finally arrives, instead of nothing happening, and possibly making your whole system behave mysteriously, an assert will be raised, and it will be very clear that some code needs to be written.

Some would claim that leaving these asserts all over is too compulsive. It may be, and there will be plenty of them that are never triggered, or that are removed (to be replaced by real code) a short time later. But, it is not hard to put these asserts in, especially once you get in the habit, and if even one of them fires, it will save you fifteen minutes (or more) of head scratching to figure out how everything got into some "impossible" state.

And if you provide yourself with a rich set of tools ahead of time:

#define NOT_YET_IMPLEMENTED() ASSERT(FALSE, "Not yet implemented")
#define SHOULD_NOT_HAPPEN()   ASSERT(FALSE, "Should not happen")

you can have expressive, strict code with very little trouble. These examples are in C++, where the preprocessor helps a bit, but the same is true in any language: your code should only do nothing if nothing is the correct thing to do.

(react)

Virtual Credit Cards

Sunday 7 April 2002 (¤)

If you have ever been the victim of credit card fraud (as I recently was), or if you are simply concerned about the possibility, you should look into Citibank's virtual account numbers stuff.

It's a simple idea: create new credit card numbers for each online transaction. Each number is limited to one merchant. If anyone else tries to charge against the number, the charge is declined. Also, you can set time limits and charge limits. So for example, if I want to buy a $30 book from a small retailer, I can generate a new virtual account number good for up to $40, with an expiration date three months from now. Even if the account number gets posted to a bulletin board, it won't do anyone any good (and using it will probably trigger fraud alarms).

Not only is the idea a good one, but I like the implementation, too. Citibank provides a Windows application that sits in the system tray, and has a slick UI. When generating the new account number, it uses a satisfying rolling numbers effect. It's precisely the kind of thing that you'd see in a movie, and you'd think, "Oh, real software doesn't look like that!" Also, once the number is generated, you can drag-and-drop it onto the edit controls in the web browser, and the whole number is in the drag cursor, providing great feedback about what is going on. Excellent!

(react)

Another bully of a company "wins" out of court

Thursday 4 April 2002 (¤)

Here's another case of a company that doesn't seem to understand what it means to have customers. This story details PetWarehouse.com's heavy-handed tactics against customers who are both vocal and unhappy. It's a classic story of a company going overboard by suing everyone in sight when the situation doesn't go the way they want.

The ultimate irony, of course, is that the company was suing to protect its trademark from being diluted by negative comments on the web. Well, PetsWarehouse.com, congratulations: you've got way more of that now that everyone's reading about your obnoxious suits.

Some of the defendants settled because they didn't have the money to fight for their rights. Other defendants (including people whose "crime" was to support the original defendants!) are still fighting. A defense fund has been established. Keep in mind: some of the current defendants have been named simply because they supported the defense fund.

What if instead of starting this brouhaha the company instead had simply refunded the original customer's money, and then donated $100 worth of product to the handful of people involved? The company would have spent a little bit of money for a small amount of good will, rather than a large amount of money for a huge amount of negative publicity.

After all, the case revolves around a complaint posted to an email digest list (I think). All the people that were reading the supposed defamation have now been front-row spectators to one of their own being dragged through the courts and made to pay ignominiously for talking about something that happened to them. No one on that mail list is going to buy from PetsWarehouse.com again. There's no way for it to have gone worse for the plaintiff.

Add to that all the people (like me) whose first news of the company was their oafish bullying of their own customers. Their competition couldn't have paid for publicity like this!

(react)

The West Wing Continuity Guide

Wednesday 3 April 2002 (¤)

For fans of The West Wing, here's The West Wing Continuity Guide, an unofficial site that prides itself on digging up facts behind the stories on the show. Fascinating.

Factoid from the site: the subplot last week about a fan website where Josh tries to defend himself and only gets into hotter water was based on Aaron Sorkin's own experiences on the Television Without Pity West Wing forum.

Isn't the web a wonderful place? I found this link while searching Google for something completely unrelated (the whereabouts of a long-forgotten ex-colleague).

(react)

Old habits die hard

Monday 1 April 2002 (¤)

I haven't used Emacs for almost 10 years (the reliance on control keys hurt my hands, and the promise of customization proved too tempting to the hacker in me). But today, while typing a text file, I wanted to make a line of hyphens, and instinctively started to type Ctrl-U 7 0 -. Somehow my hands remembered that. It even took me a split second to realize what my hands were trying to do. Wild.

(react)