Old thought: I once handed someone an example function that was basically `rand() -> 4.` (thanks, xkcd) and that made its way into production. Later, because we always had that value of 4, we'd end up with collisions during high-traffic time windows. I was a little surprised by this, but my take-away is straight forward: don't use joke examples. Folks will use them, and you'll only find out later. It only works if you're both aware of the joke – something you can't assume. Just don't do it.

Actually fixing this wasn't very interesting, by the way. It stood out in the code after we dug through it. It only showed up much later, which was the unfortunate thing.
I forget why code review didn't catch it on the team that wrote it, but we were pretty much in crunch the entire time. It's very likely that things got glossed over, or reviews were skipped entirely.

Another thing I want to make a point of: programming is full of things that are unintuitive, non-obvious, and hard. Combine that with weird power dynamics that many aren't even thinking about and you can also get cases like this. If a more senior programmer handed you `rand() -> 4.` and you're not entirely familiar with what's going on, are you going to disagree with them? Maybe they'd think you know something they don't and implement exactly that.

I don't have a good way around this except to just try to always be helpful without assuming someone knows everything you do. That's not easy, it's frankly frustrating because you can end up explaining things you didn't know you thought were obvious. It's easy to convince yourself over time that there's some minimum level of knowledge everyone must have, but it'll never be true. If you're tired or burnt out, it can be even more exhausting. Still, better to try to be aware of all this than not.

Correction on phrasing: Maybe you'd think they know something you don't and you implement exactly that.

Writing is hard and my brain inverted actors in this. I think the point gets across, but correction nonetheless.

Sign in to participate in the conversation
big trash haus

A single-user instance for Noel Cower.