The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Monday, March 13, 2000

Tumbling through Code

I'm still working on the tumbler code and it's more interesting (read: complicated) than I originally thought. Basically, I think I want too much here.

I already parse Bible notations and to that I want to add a date-based reference system for the journal here. The bible notation is of the form:

book `.' chapter `:' verse

while the date based version is:

year `/' month `/' day `.' entry

It's easy enough to specify multiple unit separators, but I do want to maintain a canonical form for the search engines—I'd rather not pollute them with multiple references to the same page, so if someone were to request Genesis.1.1 (note the period instead of a colon), they would be redirected (via a permanent redirection) to Genesis.1:1 (note the colon). Similar for the date tumblers.

So now, while I can accept multiple unit separators, I need to keep track of which are the prefered ones, and which aren't, and do redirection accordingly. Doing this without making the code a horrendous mess is not easy.

Then there is the spelling correction (at least as far as the Electric King James goes)—someone can still have a correctly formatted reference to a book, say Eklesiastics.1:3 and yet it isn't correct. It's not E-K-L-E-S-I-A-S-T-I-C-S, it's E-C-C-L-E-S-I-A-S-T-E-S (don't worry, I can't spell either). In that case, I can detect what the user was most likely trying to get to and again, send a redirection to Ecclesiastes.1:3. But that's something else I need to keep track of.

Eight versions of the tumbler code later, I think I have it working, but I decide to ask for a second opinion. So I ask Mark how he would do it.

“A single unit separator, and if a user specified the wrong unit specifier, it's an error that is reported back to the user,” he said.

“What type of error? 404? Technically it's not found,” I said.

“Maybe not a 404, but an error page should come back, possibly saying `This is how you need to form the request,' ” he said.

“I hate programs like that, Mark. They can detect the error, they can even correct for the error yet they don't.”

“I'm for strict parsing rules and if they're not correct, it's an error.”

In once sense, his way is easier for the programmer—it's this format or it's an error. The code is eaiser to write and possibly maintain but it makes more work for the user. My way is harder to write, get correct and possibly maintain but is more forgiving of human input error and tries to do the Right Thing.

Coincidently, Mark doesn't like computers that attempt to do The Right Thing. Can't say I blame him much—many programs that attempt to do The Right Thing fail miserably all around. And he does have a point in that my tumbler code may be trying too hard to be general use, what with flags being passed back and forth.

Which explains the eight versions of code.

I think I finally have it though.

Obligatory Picture

[The future's so bright, I gotta wear shades]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.