Clutch

Scientist Ruby library for refactoring critical paths

Scientist Ruby library for refactoring critical paths
Average rating: 1
(1 votes)

Sometimes we envy you. Such great things are still waiting for you! For example, more and more fantastic ruby libraries appear and we can’t keep silent about that. Meet Scientist Ruby library for refactoring critical paths.

Scientist Ruby library is used for careful refactoring critical paths. Let’s start from the beginning.

The first thing to do, you need to compare the current and refactored behaviors under load. Wrap a use block around the code’s original behavior, and wrap try around the new behavior. experiment.run will always return whatever the use block returns, but it does a bunch of stuff behind the scenes:

  • It decides whether or not to run the try block,
  • Randomizes the order in which use and try blocks are run,
  • Measures the durations of all behaviors,
  • Compares the result of try to the result of use,
  • Swallows any exceptions raised in the try block, and
  • Publishes all this information.

Scientist compares control and candidate values using ==. To override this behavior, use compare to define how to compare observed values instead.  You can disable an experiment by setting a run_if block. If this returns false, the experiment will merely return the control value. Otherwise, it defers to the experiment’s configured enabled? method.

Try it by yourself and read more here.

And one more famous book you have to read. Meet ‘The Well-Grounded Rubyist‘. The 3rd edition. You can always rely on us!

As a custom software development agency, we can make your next Ruby project a smooth sailing! Contact Syndicode to develop something really outstanding!

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

*By submitting this form you agree with our Privacy Policy.

Mailing & Legal Address

Syndicode Inc. 340 S Lemon Ave #3299, Walnut CA, 91789, USA

Visiting & Headquarters address
Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
Email info@syndicode.com
Phone (+1) 9035021111