The Problem With Software: Why Smart Engineers Write Bad Code
by Adam Barr
This book works to explain why software doesn't work better — why software makes mistakes and why it remains vulnerable to attack. I’ll take up the book’s argument in a later post. First, I want to set the scene: software is hard because the world is complicated. Even the easiest things turn out to be very tricky when you examine them closely.
Suppose you’re writing a program one day, and you need to store people’s names. That’s easy enough, right?
- In the old days, you’d allocate two chunks of memory that would be sufficient to hold the first name and the last name. That’s how Storyspace 1 worked, and Lotus Agenda, and lots more. “Big enough” is never really big enough; just ask the fellow who was asked to sew Jarrod Saltalamacchia’s name on the back of his baseball uniform.
- OK: we don’t do that anymore. We have variable-length strings. First name, last name, we’re done, right! That’ll work for a bunch of names in the US, anyway.
- Of course, lots of people have middle names. So add them to the first name. Except that sometimes people are known by a middle name. So “first name” is a bunch of names.
- In China (and lots of other places), the family name comes first, not second. So “last name” isn’t right, either.
- But everyone knows that Americans get confused by Chinese names, and sometimes people helpfully invert them for you so you'll get them right. But then you might invert them again, and…
- In Iceland and in Korea, some family names are very common. So, the key for your index needs to be the first name.
- Some people don’t use a family name at all: Beyoncé, Madonna, Prince. See also UN Secretary General U Thant — the “U” is an honorific.
- Honorifics come first, except sometimes (e.g. Japan) they come last.
- It’s not unusual for several people to have identical, or nearly identical, names. There are two notable computer scientists named Catherine C. Marshall. There’s a whole bundle of other Mark Bernsteins.
- Quick: what is the last name of the great historian G. E. M. de Ste. Croix?
- Even if the last name comes last, there might be important stuff that comes after the last name. Jr., for example, or III.
- Even if the first name comes first, there might be important stuff that comes before the first name. Dr., or Brig. Gen., or Sir.
- You might think that there’s be only one prefix. Let me introduce you to Prof. Dr. Dr. N. Deutschlander.
- Lots of people change their names.
- Sometimes, people use different names. If you're a director and you hate what the studio has done to your film, you couldn’t simply take your name off the monstrosity because the union wouldn’t let you. So you were credited at Alan Smithee.
- Some people have different names at work and at home. Some people have different names on their work, names they don’t use on their checks.
Patrick McKenzie wrote a classic note on Falsehoods Programmers Believe About Names, because it turns out that “Patrick McKenzie” is a really tricky name to write in Japanese. (If you’re a global enterprise, you’d better be prepared to cope with names in Japanese, Urdu, and Klingon.) Here’s the classic Falsehoods Programmers Believe About Time; you’d be amazed at how many of these have actually arisen when working on Tinderbox. On GitHub, there’s even a curated list of lists of falsehoods.
Lots of these falsehoods are obvious once you see them, but they’re seldom obvious when you’re starting out — especially when you're just recording these names as one easy step toward solving a really difficult problem. So, you're focussing on getting really fast response times or compacting the index into a really tiny amount of memory or on the transitive closure of the social graph, not on esoterica about names. And if you did think deeply about the esoterica, you’d never get anything done in the first place.
It’s a mad, mad world.