Mr. Ollivander, wand maker
and Java programmer
The wand is a very important tool in the lives of witches and wizards of the Harry Potter universe. This is a look at those wands, from the perspective a muggle computer programmer, using actual examples from the Harry Potter books.
I believe the magical wands of Harry Potter’s world could actually be tiny hand-held computers. The processors in these computers are magical-creature-based, as opposed to muggle computers, which are silicon-based. From the way they are used, we can reasonably infer that the operating systems of these computers are written in the object-oriented programming language Java.
The wand’s command interface is voice activated, and commands are comprised of objects and methods. Many objects and methods have been preprogrammed into the wand. These built-in objects and methods are named mostly in Latin.
For example, in The Sorcerer’s Stone, on the Hogwarts Express, Hermione fixes Harry’s glasses with the charm “oculus reparo”. Internally in the wand, that charm is represented this way in Wand Java:
In this case, the message reparo() (to repair) is sent to the object oculus (eye-glasses), causing the glasses to be repaired. Since most of the internal objects are dervied from the same base class, most of these pre-programmed objects could be sent this reparo() message.
There is also the possibility of an unvoiced object that is derived by pointing the wand at something physically. In The Goblet of Fire, Hermione simply points her wand at a broken window and says “reparo”. Internally, the wand is sending the reparo() message to the derived target of the wand pointer:
Also in The Sorcerer’s Stone, in Professor Flitwick’s Charms class, Hermione demonstrates the proper way to do the levitation charm, “wingardium leviosa”:
“Wingardium” is the feather object, and sending the leviosa() message to it causes the object to be levitated.
Under certain conditions, the pointer object and the voiced object can be evaluated together. For example, later in The Sorcerer’s Stone, Ron points his wand at the troll’s club and yells “Wingardium Leviosa!” In this case, the voiced object, “wingardium”, is up-casted to the derived pointer object, the troll’s club, which is lifted up above the troll’s head:
Pointer club = new Pointer.getTarget();
Two methods, sonorus(), which causes your voice to become greatly amplified, and quietus(), which turns it off, are used with the internally derived pointer object, but are only valid when the derived pointer object of the wand is your own throat:
These functions throw an exception if you try something like pointing your wand at a Slytherin and commanding “Quietus!” Exceptions in Wand Java are nasty, and cause the wand to make a big “Bang!” and singe anything that happens to be too close to the pointer.
There are also some built-in methods which do not work on external objects like all the other methods do, they work on your own wand instead:
The lumos() function causes your wand to act as a flashlight, and the nox() function turns lumos() off. “Nox” in Latin means “night”. But, in technical jargon it could also mean “negate operation”, and presumably nox() could be used to negate any other currently operating feature of the wand, although we only have documented use of it in conjunction with lumos().
Some methods require attributes. For example, in The Prisoner of Azkaban, Professor Lupin teaches Harry and the students how to deal with a Boggart, by pointing your wand at it, thinking of something funny, and yelling “Riddikulus!”. Internally, the command is represented like this:
User image = new User.getTarget(MEMORY);
Here, the internally derived target of the pointer object is sent the riddikulus() message, with the image the user is concentrating on as an attribute, which results in the Boggart being turned into the ridiculous thing. The global constant MEMORY causes the getTarget() method of the User object to retrieve what the user is remembering. Other global constants which can be applied in this manner are SEE (retrieve what the user is looking at) and IMAGINE (retrieve something the user is imagining).
Some methods are so handy that they are also provided as static, so that even if you don’t know or can’t remember a built-in object’s latin name, or you can’t directly point your wand at it, you can apply the method to any object using its name in English as an attribute. For example, in The Goblet of Fire, to fly around the dragon in the first task of the Tri-Wizard Tournament, Harry summons his racing broomstick by using the charm “accio firebolt!”. “Accio” is the summoning method, and internally in Wand Java, that command looks like this:
Some of the other built-in methods in the wand that are used similarly to the methods described above are:
aparecium() – appear
confundo() – confuse
crucio() – torment (one of the unforgiveable curses)
deletrius() – eradicate
engorgio() – enlarge
ennervate() – revive from stun
incendio() – create fire at target
obliviate() – erase memory of target
reducio() – reverses engorgio
Finally, there is one special built-in method which only affects another wand or other wands in the derived pointer target:
Professor Snape uses the Finite Incantatum spell in The Chamber of Secrets to put an end to a duel betwen Harry and Malfoy that gets out of hand. The finiteIncantatum() method causes the operating system of the wand or wands in the target of the pointing object of your wand to reboot.