A C++ Metaphor for Life - 2001-01-29
Monday, January 29th, 2001Life is a write once-run once program. It all starts with conception, where code from two different source trees are spliced together, followed by 9-months of compiling. There’s no beta-testing, so you’re shipped at birth, bugs and all. And at that moment is when your main() function is called. Although the run-time environment provides implementations for your sleep(), eat(), and breathe() functions, you’re left to do the garbage collection. Of course, nowadays we have that third-party application known as the toilet. And on you go, running till you’re terminated somehow. And once that happens, that’s itno re-running the program and no version 2.0. Your source code is still around, but due to environment variables and the dynamic nature of the algorithms involved, a clone would be a different program in itself, not you. The particular flow of bits and bytes that is your stream of consciousness would be gone forever (unless you made a backup!).
Those who do too much at once and especially branch their activities recursively without rest will die of some kind of stack overflow. Some people end life by calling abort() themselves before any exceptional circumstances do so. And the rest of us continue to either execute or idle, surviving any exceptions that life throws at us until an unexpected one is uncaught or irrecoverable. And, in this geeky metaphor, that’s where the essence of life is: exception handling. We all have to do at least some of it at one time or another. But the most robust lives are those that try, try, and try again. No one’s life is perfect, everyone is subject to errors, but the point is to catch any that do crop up. At the top of life’s heirarchy of misfortune is an out_of_luck exception which is subclassed into out_of_work, out_of_money, out_of_time, and others. Without a try/catch block when those events occur, you’re screwed. You can’t look out for all exceptions all the time, though. Your life wouldn’t go anywhere. But it’s important to take into account the common ones, as well as some of life’s curveballs. But that’s a different metaphor altogether.