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. I have trouble imagining how hard this COVID-19 pandemic would be if we 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.
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 unexpected 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:
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.
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 it ¹. 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, dumb and predictible
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” ². All software should be simple and straightforward; it’s complicated enough in our world. We don’t need software trying to abracadabra ³ 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.