Software Developers Are the New Wizards
At some point in the recent past, software developers became wizards. Software developers can create magical tools that make our lives better, easier, and more productive (and yes, sometimes more frustrating). They do this by writing instructions for computers to execute.
Quick Summary
- Software developers create tools that improve lives, but too much “magic” (software behaving unexpectedly) can cause real problems.
- Microsoft Excel’s auto-date conversion caused scientists to rename human genes, a real-world example of software interpreting rather than obeying user input.
- The Anti-Magic Principle holds that software should do the simple, expected thing, not try to interpret what the user means without explicit instruction.
I have trouble imagining how hard this COVID-19 pandemic would be if the dymaptic team couldn’t get on a video call. Remember that the world has survived pandemics without online school, video calls, and screen sharing; software is eating the world and making our lives better.
I don’t want to rule the world, I just want to optimize it.
Why Does Software Design Philosophy Matter?
With great power comes great responsibility.
When you are a wizard wielding magic it’s easy sometimes to forget that too much magic can be a bad thing. When software does something automatically and unexpectedly because it is trying to be smarter than the person trying to work it, things can go awry. Take this article from August: “Scientists rename human genes to stop Microsoft Excel misreading them as dates”. All genetic symbols that auto-convert to dates in Excel have had their names changed.
I’m just going to let that sink in for a minute.
This seems crazy to me! Scientists are now naming things based on a generic software’s interpretation of the existing name. They are not doing this because the names were bad or for any reason that makes sense. They are doing it because a decades-old piece of software is interpreting them as dates.
Software Development Magic Time
For the software developers out there, let me make a demonstration. Dates are hard, especially time zones, but imagine how much more difficult they would be if Python did this:
>> print("MARCH1")
3/1/1970
That’s what Excel has done here. And I’m going to claim this is a violation of the Anti-Magic Principle (I didn’t coin that term, but I’m going to use it). In a nutshell, this says: Software should do the simple, expected thing, not try to interpret what the user means. In our Excel example, strings like “MARCH1” should be just that, strings, until the user takes action to tell Excel to interpret it as a date.
What Is the Anti-Magic Principle in Software Development?
Now, I don’t think that the Excel developers were malicious when they did this; they were trying to help. Users probably mean to use the date when they type one of the 12 months of the year. So, Excel should indeed auto-convert it to date. The problem is, that’s magic. As a user, you have no way to control this behavior and know what will trigger it1. In this scenario, a simple fix would be to only apply auto-formats like this when the user selects the data-type to be a Date. Otherwise, assume that the user knows better and meant what they typed.
Simple, Consistent, and Predictable.
I think that it’s essential to keep this in mind when writing software. Don’t just “keep it simple”, but “simple and consistent and dumb and predictable”2. All software should be simple and straightforward; it’s complicated enough in our world. We don’t need software trying to abracadabra3 us while naming genes!
1. That may not be entirely true, there is documentation, and there are some workarounds like putting a single quote in front of the string, but those are just that, workarounds, not solutions to the problem of magic software.
2. This is in the image subtext on https://blog.beeminder.com/magic/ and is probably the shortest description of how to avoid being magic!
3. While recently reading Harry Potter and The Methods of Rationality, I realized how similar abracadabra is to Avada Kedavra.
Photo Credit: SukiPolly Flickr via Compfight cc
Frequently Asked Questions
What is the Anti-Magic Principle in software development?
The Anti-Magic Principle states that software should do the simple, expected thing rather than trying to interpret what the user means. Good software is explicit: it waits for the user to indicate intent before taking action, rather than guessing and applying auto-conversions or hidden transformations.
Why did scientists have to rename human genes because of Microsoft Excel?
Microsoft Excel automatically converts certain text strings, including gene symbols that resemble dates, into date values. Because so much genomic data is processed in Excel, this caused enough data corruption that scientists chose to rename the genes entirely rather than fight the software. The episode became a widely cited example of “magic” software behavior causing unintended real-world consequences.
How can developers avoid “magic” behavior in their software?
Developers should follow the principle of making software simple, consistent, and predictable. Rather than auto-converting or interpreting user input, software should wait for explicit instructions from the user. If a feature requires automatic behavior, it should be opt-in rather than a default that catches users off guard.
to discuss your software development needs. We love hearing about the different projects you are working on, brainstorming solutions with you, and sharing our technical knowledge in the process.
Have a Project in Mind?
The dymaptic team loves hearing about the different projects you are working on, brainstorming solutions with you, and sharing our technical knowledge.