4 ms·
> What do you want me to do about it? When you write code that accepts names, don’t bake in assumptions that violate these falsehoods.
by mcphage 5y ago
> What do you want me to do about it?
When you write code that accepts names, don’t bake in assumptions that violate these falsehoods.
- bspammer 5y agoThe only way I can think of do that would be to not make a name field mandatory. That's certainly possible in some applications, but not in others. For example, I work in insurance and we need a name to put on the policy documents.
- mcphage 5y agoIf your company can’t insure someone whose name violates these assumptions, then the best you can do is make those assumptions clear.
- emodendroket 5y agoIf you book travel, they have something you're supposed to put in the last name field if you don't have one.
- umvi 5y agoOr do, and just don't care that Elon Musk's kid won't be able to use your application
- grammarnazzzi 5y agoYou're being obtuse. Everybody can still use the application. The just need to supply a name that is valid to the application. THIS IS REASONABLE
- emodendroket 5y agoAnd considering the great number of official forms one must fill out which make the same assumptions that programmers foolishly believe, I am inclined to believe that The Artist Formerly Known as Prince or whoever already has some idea what they'll put in the fields to accommodate their unusual situation.
- smoldesu 5y agoI think that part is pretty easy to understand, but if the author's intention is to have every single one of these issues addressed they're going about it the entirely wrong way.
- mcphage 5y agoI’m not sure anyone, including the author, considers addressing every one of those to be possible. But they want you to be aware of the assumptions you’re baking into your code, and maybe spend a few moments about which requirements you actually require. What do you think would be a better way of going about it?
- smoldesu 5y ago> What do you think would be a better way of going about it? I suppose it depends on what you're trying to accomplish. This article definitely reads like it's trying to annoy developers to the point of closing the page though, even if it's intentions are relatively agreeable. I'm reminded of the whole 'master vs main' debacle, where this kind of tribalism hit critical mass. There was huge potential for people to have a good discussion about acceptable practices in software development, but we gave it up in lieu of tribalism and us-vs-them politics. As a result, there was way more media blowback than necessary, which lead to a false sense of urgency and a whole lot of bugs. So, I don't know. But I do know that a good discussion doesn't start with 40 theses and a hostage situation.
- jiggawatts 5y agoMost of these issues can be solved by simply providing a "Name" field that accepts Unicode and has a reasonable length. Don't validate it in any way except to require at least one non-whitespace character. Trim any excess whitespace and run the text through a Unicode normalization algorithm. At most, filter out Unicode blocks that can't possibly apply, such as emoji and maths symbols. Done. That covers something like 90% of the already pretty obscure corner-cases. The remainder are likely out-of-scope, such as children that have not-yet-been-named. They can't legally sign up for things in most (all?) jurisdictions, so it's not really worth considering in most scenarios. This is already 10,000x better than ascii-only input fields for "Surname" and "Given Name" limited to something like 20 characters each. Where entering "Null" or "O'Neill" throws a HTTP/500 error because JSON is "so simple" that anyone can use it...
- dahfizz 5y agoHow do you even accept names if the name is not representable in any character encoding?
- mcphage 5y agoProbably you can't, because the person couldn't even type their name in. So if you're writing an application, that's one that's outside your control, and you can't do anything about.
- emodendroket 5y agoOK, so what I'm asking you is how I am meant to handle names which are characters that are literally impossible to represent with a computer.
- imwillofficial 5y agoThe artist formerly known as imwill eagerly awaits your answer.
- mcphage 5y agoI responded this to a different thread also, but: Probably you can't, because the person couldn't even type their name in. So if you're writing an application, that's one that's outside your control, and you can't do anything about.