Over a million developers have joined DZone.

New GitHub Tool "Scientist" Helps Keep Refactorings from Unmitigated Disaster

"Scientist" is a new GitHub tool that helps with code refactoring. Essentially, it wraps code into an abstraction container that imitates inputs and outputs where you can put refactored code. Learn more about GitHub's latest endeavor, and this neat code refactoring tool.

· Integration Zone

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

We all know the feeling. That cold lonely chill just before we release our newly refactored code. It's not like we hope it will work perfectly, it's more like we hope it will work well in all of the critical areas and where it doesn't work it leans more toward "easily fixable bug" and less toward "unmitigated disaster."

Well, GitHub comes to the rescue! They've just released a new tool that they call "Scientist." Very simply put, it wraps up a working body of code in an abstraction container that generalizes all of the input and output. It allows you to create a similar abstraction container mimicking those inputs and outputs in which you can place your refactored code. The beauty of this is that you can test these two abstractions in parallel and effectively "bridge" the old code with your new refactored code. You can watch what happens on both paths, and even do experiments to see how well your new code holds up. In fact, this is exactly how the new bay bridge was built and tested. The new bridge was built in parallel to the old one and experiments were done with traffic to see if the new technology would measure up. Only then was the old bridge dismantled and removed.

Jesse Toth, who is an engineer at GitHub, along with her other engineering Associates at GitHub, released "Scientist". Now we as cautious software engineers can build our new code right next to our existing old code. Toth said, “You battle-test this new bridge—this new code path—while the original one is still being used." She believes that "...the scope for this is huge." And of course, it is open source and freely available to everyone!

"Scientist" is based on the methodology of "branching by abstraction". After building your old and new abstraction containers, the tool will allow you to switch between them and watch what happens. Another nice thing about this tool is that GitHub is "eating its own dog food". They created this tool internally to help them refactor existing code in the repository. In my experience a tool that is actually used by the builder of that tool is likely to be actually useful.

I suspect that "Scientist" will come in handy for developers and maintainers. I think it's worth a look.

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

Topics:
github ,refactoring ,legacy code

Published at DZone with permission of Emmett Coin. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}