Sam Gentle.com

Stateless

It's inevitable that you will experience loss. Opportunities disappear, things get lost, projects end or stop, people go away, sometimes for good. To top it all off, at some point you will experience the final, ultimate loss. To say this is an uncomfortable truth is an understatement; it is repulsive to the point where people mostly refuse to consider it at all. Nobody wants to admit that their star developer will be hit by a bus, or their business might fail, or the very consciousness they are using to think this may one day be switched off as easily as a lightbulb. But it happens all the same.

So what would the opposite look like? If instead of avoiding loss, we embraced it – expected it? Planned for it the way we do shopping trips or birthdays? If it wasn't taboo to say "we're all going to die, maybe even today", or "don't forget, team, things could go from great to insolvent in a matter of weeks"?

We actually plan for loss very well when the loss isn't personal and we can see beyond our own aversions. Software systems are often well prepared for loss. Not just designed to avoid loss, though that is also true; systems are usually designed to minimise failures, be redundant, and have backups. But beyond this, resilient software is designed to expect loss of data, loss of connectivity, and even loss of the process itself. Good software has the expectation of its own sudden demise built in as a design goal.

Perhaps the best general advice for building resilient software is to reduce its state. State is a kind of temporary baggage: the information you carry around with you while doing something that you throw away once it's done. Complex software often ends up accidentally holding onto a lot of state, and as a result becomes very sensitive to losing it. You've got a bunch of applications open on your computer right now that will just disappear if it's turned off. But well designed software tries to minimise temporary state, either by making it permanent or avoiding it altogether. Achieving this completely, the holy grail, is called being stateless.

And so too for us. The state we carry is all our incomplete actions, our half-finished projects, our "I should really get around to"s, the people and things we take for granted because we will make it up later. But what if there is no later? What if that last fight was the last fight? This is it, there's no more, and all you have left is whether you can look back, at last, and be happy with it. That may not be true today, but some day, tragically, inevitably, it will be.

To be stateless is to face into that future instead of away from it. To keep your loose ends tied, to leave nothing important unsaid, and to take the opportunities today that could disappear tomorrow. And to sleep soundly in the knowledge that if it all ended tomorrow, you made the best of the time you had.