Live data from Hacker News

Scientist: A Ruby library for carefully refactoring critical paths

github.com

11–17 of 17 posts

Re: Scientist: A Ruby library for carefully refactoring critical paths

#14
post #9

Dear lazyweb, is there a similar library for python? :)

I wrote one (https://github.com/boxed/scientist) as I found the existing ones very complicated and that just gives me a bad feeling. Since I'm the author of mutmut (https://github.com/boxed/mutmut), I also made sure my implementation was 100% mutation tested before I used it in production.

I used my implementation to replace number parsing in my work project: https://kodare.net/2021/04/04/safe_number_parsing.html

Re: Scientist: A Ruby library for carefully refactoring critical paths

#15
post #5
post #3

This is pretty cool, but in my experience critical path code generally has side effects and most code is not idempotent. That is to say it may not be safe or feasible to run the old and new code in parallel, without some special considerations. Think bidding on a auction item or transferring a bank balance.

Sure but IMO most code can and should be structured to decouple the side effect from the logic that is being replaced. Example in the transferring a bank balance, you have some storage DB you interact with, but that is an abstraction and when you run the dry run of the new code you can have an implementation that just does verification on the data from the real implementation. Anyways, it does take discipline and eff…

The library is specifically meant for safely replacing legacy implementations and they generally aren't that well structured.
Post reply on HN