Monday, April 28, 2008

why computer tech IS distinguishable from magic

Arthur C. Clarke's third law is "any sufficiently advanced technology is indistinguishable from magic" (this law has been handy for sci-fi writers who write Halloween episodes, for example). Would modern computers be indistinguishable from magic by someone from a past era?

Naw.

Three hobgoblins, if not more, scuttle the illusion that computers are magic: entropy wrecks the hardware, information's continually changing shape makes software obsolete, and engineers (hardware and software) are fallible. In the typical portrayal of magic, it doesn't have these problems. Imagine if a magus had to contend with them:
  • Entropy. Eventually, a wand would stop sending out sparks like it used to. Worse, it might start short-circuiting. Quests for hidden enchanted objects would be pointless, since those objects would long since have lost all effectiveness. Ancient books would fall apart, of course. Potions would go bad (or go good or go neutral, whatever). Flying brooms would start to give out, hopefully not during a high flight, and develop the same troubles as other wooden things, like splinters (ouch!). The power factor would demand special attention since magical actions expend so much energy, particularly in transformations of matter. No matter what the source of magical power is, that source wouldn't be inexhaustible (even if it's human thought/concentration/imagination/emotion that would still imply that each application leaves the person's consciousness reduced somehow). Anything that can operate while disconnected from a magical power source would need periodic recharging, but a "standby" or "hibernate" mode would help. Related to the power factor is the dissipation factor. The efficiency of magicked widgets wouldn't be absolute, resulting in a certain amount of magic leakage. Presumably, the leakage wouldn't be desirable, and overuse might produce an (apocalyptic?) overheated state. On the other hand, purposely approaching this limit for the sake of performance might be reasonable if done conscientiously. One would hope that the manufacturer would be overly conservative in estimating the threshold.
  • Information malleability. First of all, spells would be much more specific than commonly assumed. The desired effects represent a finely-detailed confluence of information; else the vivified brooms will never stop carrying water in buckets from here to there, which would be an exceedingly serious bug, eh? The spell must precisely communicate its intent because the information must come from somewhere, and the information to produce a specified effect is always conserved. This means that the spell to transform someone into a newt is different than the spell to transform someone into a toad. And what if needs change in the future? For instance, now the toad must be able to retain the power of speech? Well, with any luck, the original spell-writer will have accommodated that by making the preserved human attributes configurable through additional optional spell clauses--if the spell-writer wasn't enough of a soothsayer to predict that need, then a new, complex spell is required. As for the toad, if the human's vocabulary wasn't extracted and stored just in case during the process of the first transformation, then the sorcerer has no other option than starting again with a different subject. Then there's the situation of a kitchen spell that automatically washes pans with steel wool. That's great until buying a Teflon skillet. A golem guard under instructions to pulverize uninvited visitors, like pushy salespeople, may seem great until it mashes your next-door neighbor, who came by to drop off the newspapers that were delivered during your vacation. A spell to create one hundred units of currency out of air is fairly convenient in the U.S. (your 15% interest rate credit card doesn't count), but chanting the same spell in Japan is not.
  • Human fallibility. Oh, sure, tales of less-than-stellar mages aren't hard to find, and neither are tales of inadvisable attempts at something poorly understood. However, it's relatively unusual to find accounts of a normal practitioner who has a level 5 certification and occasionally fails to perfectly complete a level 3 incantation. Oops, the caster slurred a few words. When he or she was visualizing what should happen, concentration dropped for a moment or the envisioned vehicle's interior wasn't considered. Too many drops of the sixth ingredient went in, and now the concoction is worthless. The crystal ball is a tad oblong, causing everything to look horizontally stretched. A Trinket of Power has some flaws that necessitate tapping it several times whenever it intermittently stops functioning. When the spellbook was copied, several errata crept in. Some unnoticed iocaine powder was on the witch's fingers when she was stirring the cauldron, and consequently the antidote mysteriously acted like a poison. Instructions for the bewitching of the shoes didn't explicitly state that the shoes had to be made by leprechauns. Wearing an Invisibility Anklet or Invincibility Brooch is fine, but wearing both at once causes problems during the night of the 1st quarter of the moon. And the Bow of Elvish Accuracy only is compatible with FairyGenuine arrows, although any Crossbow of Standard Aim should at least wing the target with arrows that claim to match the Warlock Council's Archery Dictates.
Computer technology is indistinguishable from magic. Heh. I wish.

Saturday, April 26, 2008

Law of SF Allusions

Any long-running SF work will allude, at least once, to something in this list:
  • The Wizard of Oz
  • Alice in Wonderland (and/or Through the Looking Glass)
  • Willy Wonka & The Chocolate Factory
  • Hitchhiker's Guide to the Galaxy (look for the number 42!)
  • H. P. Lovecraft's stories

Tuesday, April 22, 2008

a vanity comment is a code smell

A "vanity" comment isn't an explanation about the code but the rationale behind why the code is written in a naughty way. Its goal is to remind the reader that the code was indeed written by a professional, appearances notwithstanding. In contrast, the goal of most comments is to aid the comprehension of the code. Comments about legitimate design trade-offs and comments about how the current case is a valid exception are not vanity comments. A "TODO" comment, particularly vague examples like "TODO: rewrite", may or may not in fact be a vanity comment, depending on its seriousness. (Does the writer really plan to revise this section or was it merely wishful thinking that he or she would later have the time?)

The point is, if vanity comments have proliferated throughout the code, then the net indication is that the author is lazy rather than incompetent. He or she knew the shape the code should have taken but unilaterally decided to do what was easier. (Rational laziness, i.e. the calculated reduction of total/overall effort by considering the marginal benefit for each marginal cost, is a different category--cutting corners in a tiny shell script that performs one function is okay, while setting styles of individual web pages/templates through a GUI instead of site-wide CSS will bite you later.) The vanity comment shows that the coder wasn't ignorant. Taken together with the adage "Never attribute to malice that which can be adequately explained by stupidity", the vanity comment seems to imply that since stupidity or ignorance isn't the reason behind the sloppy work, malice is the correct conclusion. The developer who created the sub-par code but was thoughtful enough to hang a lampshade on it hates you, the maintenance programmer! Maybe "hates" is too presumptive a term; "devalues" or "dismisses" might be closer.

Code that contains vanity comments should be examined carefully, because quality was not forefront in the mind that birthed it. The occasional vanity comment, especially related to breaking a dogmatic and/or stylistic "rule", is fine if it provides a credible justification. Vanity comments that substitute for following good practices are not. And those comments raise the question of the thoroughness of everything else.

Tuesday, April 08, 2008

my rhetorical compulsion

  • rhetorical - of or relating to rhetoric
  • rhetoric - the study of the effective use of language
  • compulsion - an irresistible impulse to act, regardless of the rationality of the motivation
I have a rhetorical compulsion. I suspect it's rare. It isn't even as popular as others in its category such as semicolon aversion. It's at once general, pervasive, and easily triggered. It's also simple in concept and tricky to fulfill. It's this: don't reuse non-basic words.

All the tenses of words like "I", "it", "be", "do", "have" are basic. Not reusing those words would be certifiably insane. My compulsion pertains solely to non-basic words. The previous paragraph's non-basic words include but are not limited to: "rhetorical", "compulsion", "suspect", "popular", "aversion", "general", "pervasive", "simple"... "Compulsion" is an exception since it's the subject in this case. As I compose a blog entry in Firefox I frequently activate the convenient "Find in this page" function to perform a redundance check with my hands staying on the keyboard. It's the next best thing to paying attention to the communication of my point.

I blame the growth of my rhetorical compulsion to several influences. The most reasonable of the bunch is that a moderate version of it is widespread advice: strive for precise, varied, colorful word choices. I'd add a close corollary: if every other sentence contains "very" then you should try harder, mmm'kay?

Another component is my awareness of stylometry. I'm perturbed by the thought that my mind can be correlated however imperfectly to analyses of my prose. What makes that annoyance still more illogical is that at the same time I know I have a particular style and I'm in fact unapologetic about it. Yet I avoid repetition in the hopeless effort to render myself more incalculable.

To flourish, especially in the beginning, a compulsion must have a driver that regularly presents the stimulus. Mine is when I read now and can't help noticing the author's favorite terms, descriptions, and expressions. "Huh. These characters' lips twitch a lot, and they often speak 'dryly'." I concede that it's unfair to compare the level of monotony in a novel to that of a blog (or an amateurish short story), but if I was applying a sense of proportion I wouldn't be compulsive about it, would I?

A vital ingredient of a habit is that it meets a real or imagined need of the actor. It somehow satisfies. In this instance, one of the favorable outcomes is remembering and using marginally obscure words. I'm not so far gone that I skim the thesaurus or dictionary for amusement (not enough plot). Nevertheless, I enjoy a little variety and novelty in my vocabulary, somewhat like listening to randomized playback or purposely not eating the same entrée at the same restaurant. And let's not bother to pretend that all words have equal zest.

Perhaps the ideal way to end this therapy session is a quote that exemplifies the disdain-provoking opposite extreme of my rhetorical compulsion:
You're asking me to be rational. That is something I know I cannot do. Believe me, I wish I could just wish away my feelings, but I can't.
UPDATE (04/22/08): Handy word frequency counter here: http://www.writewords.org.uk/word_count.asp . Test my posts. G'head. Dare ya.