Don't lie to the computer
This seems like a funny thing to say. Why would anyone ever lie to a computer? To spare its feelings? Social awkwardness? It’s absurd!
But it actually happens more often than you think in programming, and it usually ends in tears - computers, as we all know, are really dumb. They won’t figure out that you’re lying and do the right thing, they’ll just take you at your word.
This happens sometimes with things like bug databases and alerts. I’ve seen teams do things like invent “bug level 2.5” because the level 3’s were too messy to deal with but they needed to fix some things that were not really as bad as 2’s. This is lying to the computer! You’re pretending there’s really this other level and that it’s ok that there are so many 3’s, but it’s not true.
领英推荐
This can happen in software design too. Usually it takes the form of not really thinking clearly about what the fundamentals of the problem at hand are. It could be that you’ve designed something that is O(N^2) and are ignoring the fact that it’s possible to have really large inputs. Or it might be that you’re pretending that some algorithm can compute something in all cases, when it’s really only working in the current case you care about. That would be ok, but if it gets labelled “general thing”, that’s lying, and at some point the computer or a fellow programmer will fall over because of it.
It’s always tempting to lie to the computer. We often don’t have time to think through all of the edge cases and implications of a design, and we’re impatient, so being dishonest about what the problem really is so we can ignore parts of it is really tempting. But with any other relationship, lying is usually not a good idea in the long run. :)