Strange Programmer Habits

If you've been programming for a while, you've probably seen your fair share of weird code. Much of that weird code is just plain bad; it isn't obvious, it's undocumented and it makes the person maintaining it thing "what the hell were they thinking?" Eventually you learn software rarely emerges fully formed from some heroic programmer's forehead. It's a collection of hacks layered on top of each other (most applied at 3AM after your system goes down.)

However... there are a number of constructions I've come across that appeared strange at first, but then later turned out to embody non-obvious wisdom.

This is an attempt to catalog a few of these patterns. You don't have to use them. You don't have to agree with them. But it might be worth learning about them so you'll know more about what the original author was thinking.