Re:Scientist: A Ruby library for carefully refactoring criti...
by tobyhinloopen on Sunday November 10, 2019 @10:28AM
(#21498311)
Alternative title: “Scientist: A Ruby library for changing production code while still not having to write tests”
[ Parent
| on HN ]
Re:Scientist: A Ruby library for carefully refactoring criti...
by hinkley on Sunday November 10, 2019 @11:26AM
(#21498622)
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.
Re:Scientist: A Ruby library for carefully refactoring criti...
by jbarnette on Sunday November 10, 2019 @06:46PM
(#21500981)
By the time we extracted Scientist, the code we were refactoring had pretty good test coverage. But even the best test suite is an imperfect model of production. The first section of the README briefly mentions this:
"Let's pretend you're changing the way you handle permissions in a large web app. Tests can help guide your refactoring, but you really want to compare the current and refactored behaviors under load."
Re:Scientist: A Ruby library for carefully refactoring criti...
by Xylakant on Sunday November 10, 2019 @05:01PM
(#21500444)
Even in a well-tested codebase some integration points are extremely hard to test, notably external services that you connect to. Rewriting these to use a different service or just a different way of connecting to a service would be an example where this ends up being useful.
Re:Scientist: A Ruby library for carefully refactoring criti...
by hamandcheese on Sunday November 10, 2019 @03:28PM
(#21499998)
Which is really valuable if you don’t have tests, or your test suite doesn’t give you much confidence, is too brittle to make the changes without breaking the tests, or maybe the code is structured so that it’s really hard to test all the paths that occur in production.