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 now cover 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 structure that is easy to understand. It also has 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 with refactoring puzzles 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 same password everywhere?