Yesterday evening, I had an itch that needed scratching.
I was lacking some convenience features in an XMetaL-based authoring environment I am finalising for a client. There is a structure in the DTD that I am presenting as a table using some CSS in the editor, which makes perfect sense since it’s always going to be formatted that way when published. Presenting a structure as a table in XMetaL, however, means that XMetaL will hide the elements defined as table rows; it’s a side effect of how tables are presented in the editor and most editors have similar problems.
But where HTML or CALS tables are supported by XMetaL‘s customisations for tables (with adding or deleting rows or cells), my custom structure isn’t. It only looks like a table, it isn’t one because the actual semantics are quite different when studied in detail, and so the standard table functionality is not available. I needed custom code for my table-like structure.
Under normal circumstances, I’d simply walk over to a colleague, describe my problem and let him do his magic. There is something slightly twisted and evil in any object-oriented programming, and I usually want no part of it. You have an “object” that, depending on things you very often can’t see or would not fully fathom anyway, have special magical abilities you can use to solve your problem, which is all fine and well, but very often, you also have a seemingly similar “object” that doesn’t have those magical abilities. It instead possesses different ones, and because you are but a learner and only borrowing the magic wand, you eventually leave it be.
It’s evil.
But this time, I thought “how hard can it be?” and started writing, aided by other people’s efforts, an XMetaL Programmer’s Guide, and an Ouija board (no, not really; just Notepad ++). Soon, those magical objects appeared with their special abilities, and I started invoking magic using while loops and other features I know from scripting languages. Remember Mickey Mouse in Fantasia? That’s me, thinking “how hard can it be?”
The difference was that the magic here is better protected. Mickey never had access to Ctrl+Z.
Two hours later, I had my little convenience functions. The sorcerer has yet to return, but I am confident that my code works. The broom does what it’s told to do.