To rewrite or not to rewrite, that is the question many Ruby developers face. GitHub wants to help you decide if refactoring code is really your best option, which is why it’s introducing Scientist.
The tool is pretty straightforward: it uses your legacy code, and compares its performance to new code. It then takes return values, and lets you know if your new code is ready for production.
It’s meant for testing pull requests. As projects get larger, Scientist can held expedite your workflow by quickly testing if the candidate code will even work — or if it will break something.
If Scientist sounds a bit like Swift.org’s new Continuous Integration, it’s because it’s a very similar tool — just meant for Ruby. The difference is that CI lets you know if all the code in a pull request will work, while Scientist tests code on how it would perform against real traffic.
The GitHub team has been using it internally for refactoring and a large clean-up of its permissions code, but warn it will hinder performance slightly, and isn’t meant for code that has side effects.
➤ Scientist: Measure Twice, Cut Over Once [GitHub]