This article was originally published over at the Codurance blog.

In the second of three videos, Matthew Butt of Codurance demonstrates how to compose simple automated refactoring steps in ReSharper to refactor code to better designs.

In this episode we spot a conditional with three branches. We Decompose this Conditional to clarify the logic, and then Extract Method Objects to encapsulate the behaviour of each branch. By the time we’ve finished, we are well on our way to implementing polymorphism.

Part II: Steps towards Polymorphism

The code used in this video can be found on GitHub