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

 

Complex Refactoring Part II

| Methodology & Culture| 391 views | 0 Comments
About The Author
- Matthew believes that people and their relationships should be at the heart of our work as software developers. Since he started working with code in 2000 he has always focused on creating well-crafted software, and building close collaborative relationships within and beyond the technical team. Recently Matthew has worked primarily on the .NET platform, and he is experienced in giving new life to legacy code written in C# and VB, as well as crafting projects that take advantage of the latest developments on the platform. Matthew is passionate about teaching excellence in software development, and he is equally at home running a one-hour workshop or designing and implementing a six-month apprenticeship programme. He is a regular participant in the wider Software Craftsmanship and Extreme programming communities.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>