

Tracking Down A Subtle Analytics Bug - soundsop
http://www.kalzumeus.com/2009/10/31/subtle-analytics-bu/

======
patio11
This is a lot heavier on the code/hacking than usual for my blog. I'd be
interested in hearing whether y'all like it more or less than usual.

~~~
stakent
Adding some technical details to your posts enlarges your audience.

I like this post as well as previous ones.

------
stakent
Another solution is to save state of the (pseudo)random generator and then
restore it. In python: random.getstate()and random.setstate().

~~~
patio11
The only problem with that is that a termination of your code in between those
two points (which could be caused by an exception, a client timeout, etc)
leaves you right back where we started.

You can use begin/rescue/ensure (Ruby's try/catch/finally) to try to prevent
that, but it strikes me as unclean. In addition to having to catch a very wide
scope of exceptions, I'm not sure you can actually ensure the ensure block
executes. (A trivial example: suppose I call out to library code that I don't
understand and, for whatever reason, it calls exit. The ensure block will
_not_ execute. Granted, that would take care of my problem because the process
was dead, but speaking generally, it is dangerous to assume that ensure
actually ensures anything in generic circumstances.)

~~~
stakent
Right. It seems we are closer to conclusion that side effects are _bad_.

Functional programming on the horizon?

