The nice men in the white coats

When you do the same thing again and again, and expect a different result, that’s insanity.
When you do the same thing again and again, and get a different result, that’s stateful programming.
Stateful programming will teach you to expect different results when doing the same thing repeatedly.
It is impossible to write code which runs without state.

How’s your job working out for you?

This entry was posted in Uncategorized. Bookmark the permalink.

5 Responses to The nice men in the white coats

  1. anonymous's avatar anonymous says:

    Haskell users would argue that you can write code without state.

  2. sirenian's avatar sirenian says:

    How do you run it without state, though?

  3. anonymous's avatar anonymous says:

    Yet it is possible to write code functional style.
    I blogged it here: http://liquiddevelopment.blogspot.com/2005/12/functional-style.html

    –Chiaroscuro

  4. anonymous's avatar anonymous says:

    As a filter. A function transforms input to output and it’s behaviour is defined purely by it’s code and it’s inputs and outputs.

    I thought the joke was funnier when I told it at XTC. Maybe I had drunk too much London Pride.

  5. sirenian's avatar sirenian says:

    it’s [sic] behaviour is defined purely by it’s code and it’s inputs and outputs

    …and the state of the machine on which it’s running…

    I agree that a function can be written to have no state of its own, but I have yet to hear of code which doesn’t occasionally fall over due to some unforseen state of the configuration required to run it.

    Even something as simple as “hello world” can stop working if, for example, you happen one day to be running something else that messes up your Ruby config.

    Or maybe run out of memory. Or file handles. That was a really nasty one.

Leave a reply to anonymous Cancel reply