Refactoring example in C# and VB.NET

Our very own Bryant Smith has revamped his conversion of Martin Fowler’s refactoring example (originally in Java) to nowcover both C# and VB.NET.

You can find the article here with the relevant downloads and walkthrough.

Martin Fowler’s example works nicely because it is a simple class structurethat is easy to understand. It alsohas enough complexity to allow refactorings like MoveMethod to show how data and operations should be related. I also like Bob Martin’s refactoring example on generating primes but it doesn’t have much of the OO feel since the whole thing is really just one method being broken out with little instance data. Both examples are great for debating techniques and trying out new ideas. A book filled withrefactoringpuzzles would be a great resource … anyone?

Our team has a weekly Friday morning meeting where we experiment with new techniques and ideas – we have done both of the mentioned refactoring examples by breaking our team into programming pairs and then comparing their solutions at the end. This is a lot of fun and allows the team to experiment with refactoring ideas outside of the deadline crunch. Both examples have worked well in this environment and have helped to spread adoption and familiarity of refactoring techniques across the group. Of course, everyday pairing also helps but sometimes it is nice to refactor it several different ways and then compare approaches (something a client might not be too excited about! :)) – although the learning experience is fantastic.

If you are interested in joining our team where we practice Test Driven Development, Pair Programming and Refactoring daily – we are hiring.

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC. Our product, Secret Server is an enterprise password management system for teams to secure their passwords. Where do you keep your passwords or do you use the samepassword everywhere?

  1. http://
    March 12, 2008 at 9:42 pm

    Searching for Refactoring

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: