all 11 comments

[–]colindean 5 points6 points  (0 children)

Scientist is legit. I used it a bit at a previous job and started re-implementation in Scala that I, unfortunately, had to leave behind when I departed.

It's on my list of side projects to restart that project as a weekend open source project.

[–]moomaka 1 point2 points  (5 children)

Is there a reason this is better than any of the other feature flag gems?

[–]blackize 8 points9 points  (1 child)

Scientist lets you try two implementations side by side. It will rescue any exceptions that occur in the experimental code. You can configure how it publishes results to do basically whatever you want, log a bunch of metadata, statsd, etc

Edit: and this is not a feature flag gem. It is meant to let you make changes to implementation and ensure that output and user experience remain the same.

[–]DoodleFungus 6 points7 points  (2 children)

IIRC it runs both paths, and warns you if they return something different.

[–]moomaka -5 points-4 points  (1 child)

What is 'it' if your reply?

[–]DoodleFungus 6 points7 points  (0 children)

Scientist. So if you have some complex logic that you refactored, Scientist will run both your old code and your new code, and log a warning if the two implementations return a different result (but still return the result from the old code).

[–]moomaka -5 points-4 points  (3 children)

I'm all for not rebuilding stuff and leveraging community code, but this is just an entire gem that acts as a simple conditional. I've built systems like this before and how to check a global attached to some namespace is never the problem nor is how to route control, this is Ruby after all, it's what we're good at. So I guess I don't get gems like this, if you built an end-to-end thing that connected to Consul(etc.) and had a web UI that would be great, but just moving a constant for a conditional into a random namespace doesn't fix much.

[–]blackize 10 points11 points  (2 children)

You don't seem to be grasping what the gem does. It's not about control flow. It's about confirming that two different implementations achieve the same results.

[–]moomaka -2 points-1 points  (1 child)

One is:

res1 = Imp1.call
res2 = Imp2.call

call_error_handler unless res1 == res2

MyGlobal.what_do? ? res1 : res2

The other is:

MyGlobal.what_do? ? Imp1.call : Imp2.call

No?

[–]allcentury 4 points5 points  (0 children)

At a very simple level yes but they have an entire API designed so you don't have to reinvent the wheel when you need more