4 ms·
If people read the manual before operating a dangerous machine we wouldn't need terms like "misuse resistance". Documentation is not a substitute for safe API d
by lifthrasiir 5y ago
If people read the manual before operating a dangerous machine we wouldn't need terms like "misuse resistance". Documentation is not a substitute for safe API design.
- tialaramex 5y agoThe eventual point of the article's shaggy dog story is even "misuse resistance resistance" in VSCode. There's an API provided which looks exactly like the API you'd provide that resists misuse but in fact it's designed in a way that enables misuse instead. Why? In this particular case they know you might need to pass a bunch of completely unrelated strings, and they know their underlying primitive can't really do that, and so they... provide code that just concatenates all your strings, as if you're a programmer who doesn't know how to concatenate strings and needs help with that. The best excuse I can imagine is somebody at VSCode assigned a junior the task of writing the trivial "escape everything properly and concatenate it" function. Except, that function isn't trivial, and the junior lacked confidence to come back with the answer "This isn't trivial after all, I need a grown-up" so they hacked up a solution that doesn't solve anything, checked it in and breathed a sigh of relief when it passed review.