The Importance of Type Checking in Names

Today I have come across an interesting bug regarding names. In our integrations at work, we have a check for both undefined and null in names, since it did happen in the past, that we would simply concatenate these to a string and show them. JavaScript would allow you to do this. In this case, we would check, if it is valid or not and adjust based on this.

So it was weird, when an integration, that would just use the name field from the API started to throw these errors. This was the users endpoint in question. And when I check, there seems to be a couple of names in the form of 'null lastName'.

Now, I can not assume, that these are not a valid names. I am aware I am using a lot of assumptions in what a name looks like and that there are people with the null as last name.

  • https://www.wired.com/2015/11/null/
  • https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

Null would also be a legal name in Slovenia, at least according to the law about personal names. Expect if the bureaucrats would warn parents, that it could hurt the child. But even in this case, if the parents do not choose a new name, the old one stays - but the social workers are notified.

Considering the level of programming knowledge in the general population, I do doubt it would fall in their view of hurtful names.

But thankfully, our company was also using this integrations we wrote. And the problem also showed in their case. Looking over the problematic cases by hand, in all the cases in our company it was not an actual name. It seems more like the case of missing first name, that got combined with a bit unexpected results.

We already adjusted to deal with this, so it will not bring us additional warnings. But it was nice to see, that even bigger companies do still let something like that slip. And Atlassian is a bigger company than us, both by revenue and employee count.

It is also a problem, that one of my coworker would probably point out as valid case for why we should be doing more type checking in our code.