Down With State!


Note the absence of the definite article. Especially after my debugging experience last week, I hate state. The more state you keep around, the more things that can go wrong. The more you cache values rather than recompute them as needed, the greater the chance that they'll be wrong just when you turn to use them. The more things that can be modified, the more things you need to protect from being modified when you don't want them to be. The more you keep written down and shoved off in data structures, the harder it is to figure out quickly what's going wrong when something goes wrong, the less helpful that stack trace becomes. The more variables and aliases and interactions, the harder it is to pull apart a segment of code and just plain understand what it does. The more state a protocol keeps, the more vulnerable it becomes to denial-of-service flood attacks. The more information you write down, the more you need to protect from prying eyes. The more different pieces of data that affect the workings of a program, the more likely it is to die mysteriously but painfully as it collapses under the state-weight of accumulated cruft. The more you try to remember, the more dangerous forgetting becomes.