# On Magic Every company has its own dialect. One fragment that's stayed with me from my first job is "magic" as a curse word. To most people the term's connotations are almost entirely positive, but software developers are more ambivalent; when the creators of a library or framework say that it works "as if by magic", too often this means underdocumented, incomprehensible behaviour when you actually *need* to understand how it works. In the CMX team (as it was called), the magic we complained about was mostly reflection, some culprits being Spring's setter injection, Wicket's awful [PropertyModel](http://wicket.apache.org/apidocs/1.4/org/apache/wicket/model/PropertyModel.html) (a shame that a framework which is usually a pinnacle of object-oriented design also gives one the tools to violate it so thoroughly), and to a lesser extent Hibernate. Each of these represents a "magical" way to change properties of your objects - a way that's invisible to one's IDE and one's eyes, that can violate the invariants otherwise enforced in constructors, and so makes it much harder to safely refactor code. Really, we should expect nothing less from "magic"; what else does it mean but something that violates rules and invariants? But all too often fiction writers seem to treat magic as just another kind of technology; something that follows a different set of rules, but does so reliably, discoverably. For a setting like *Harry Potter*, where the same spell will do the same thing every time, all that would be needed to tell the same story as science fiction is a bit more attention to detail. Still, at least such a system is balanced; a [scientifically-minded Harry Potter](http://hpmor.com) could use the spells a little more effectively, but wouldn't instantly destroy all his enemies (unless he was *very* clever). I reserve a special level of annoyance for metaphor-as-magic (which I most recently encountered in China MiƩville's *Kraken*), since any vaguely experimentally-minded user would surely be changing whole continents within five minutes of attaining such power. About the only compelling fictional magic I've seen is where there's an intelligent, malevolent entity on the other end. Chris Wooding's recent series (starting with *Retribution Falls*) does this well; rather than "magic", this setting contains only "daemonology", which requires entrapping and/or bargaining with creatures beyond human ken. I recommend it to anyone with a liking for steampunk swashbuckling. Best of all recent treatments of magic, of course, is *Puella Magi Madoka Magica*. It offers a realistic world, grounded in science and reason, but combines it with a magic that's as unpredictable and terrifying as the word should imply. So if you're thinking of claiming your software is magic, be warned; this will be my first thought: ![Kyubey](/qb.jpg) [Home](/) <div id="disqus_thread"></div> comments powered by Disqus