
Scientist: A Ruby library for carefully refactoring critical paths - kburman
https://github.com/github/scientist
======
jamesfzhang
I've use Scientist for every major refactor I've done--IMO it's one of the
best examples of a library that does one thing extremely well and has a clean
interface.

------
Manfred
Feeding production data into two different paths to compare them is obviously
valuable. Does anyone have any good reasons why this has to happen in online
code and can't happen against database replicas in offline mode?

I always feel that it would be great to be able to do this with code that has
side-effects (eg. anything that changes the database) but I've never seen a
general purpose solution for this. The README mentions using a write replica,
but how do you deal with data drifting in case of bad writes?

~~~
jauco
There’s goreplay[0]. But once you start using that you quickly find that many
parts of your app use random data (such as uuids) or clock data (timestamps
etc) getting these synced between prod and replay or ignored on replay is
quite a hassle.

[0]: [https://goreplay.org/](https://goreplay.org/)

------
aflag
How to handle the case when you want to replace a function that makes changes
to a database? Is this library aimed only towards functions which don't make
changes to the system's state?

~~~
blairanderson
How would you handle this case WITHOUT this library?

~~~
aflag
I'm not experienced in running live experiments. So, I don't know.

------
tobyhinloopen
Alternative title: “Scientist: A Ruby library for changing production code
while still not having to write tests”

~~~
hinkley
In TDD they might call these pinning tests.

This kind of testing isn’t just good for refactors. You can also use it for
rewrites or substantial architectural changes. I think github did something
like this while trying to make the storage format more efficient.

------
ydnaclementine
Using this at work last week to refactor a database call to a new service call

------
sentrysapper
is there a library like this for PHP?

~~~
e12e
See
[https://github.com/github/scientist/blob/master/README.md#al...](https://github.com/github/scientist/blob/master/README.md#alternatives)

