A cautionary tale of namespaces

Posted by Dave Winer, 12/18/04 at 6:38:47 AM.

Here's a little vignette, a cautionary tale, how even the most cautious of Frontier programmers can get caught in a web of entangled names and end up with breakage on his primary site.

A few months ago the search page on Scripting News stopped working. You'd choose it from the popup on www.scripting.com, click on GO, but it wouldn't go.

You'd get an error page saying there was no page named rightEdgePopupRedirect.

I went to look at the site for archive.scripting.com, looked in the "misc" sub-table and sure enough it was there.

I tried entering the URL in my browser, got the same error.

Looked through the server, quickly, but couldn't figure out what was wrong, and decided to come back to it (I was fighting other fires).

When I came back a few weeks later, I decided to get scientific about it, figuring there was a namespace collision somewhere, I'd step through mainResponder.respond and see what it was actually serving. But something went wrong there too, and I didn't get a conclusive answer.

Then emails from irate users finally got me to look into this really seriously, and within a few minutes of investigation I found the problem.

I had created a new Tool, for little miscellaneous things that didn't deserve their own tools named (you've probably guessed it already) misc.root.

One of the things a tool does is grab a sub-directory named after the tool. So all hits to the server, regardless what domain they were for, pass through this filter, and if the name of the sub-directory is "misc" it gets the hit. I'd found the problem, but wondered how I could protect myself from making the mistake again. The sad truth is, there is no way to protect against it. The way to lessen the likelihood that there's a namespace collision is to choose really funky names. I don't like that approach either.

Anyway, that's part of the reason I'm so in favor of a conservative approach to adding new stuff. And I'd love to come up with a strategy that works, instead of fumbling around.

Discuss