Tuesday, January 3, 2012

Refactoring for fun and profit

I have been working on the "convert C++ to C#" project for several months, and this week I have achieved the "factor out code to objects" level. It has been a long, long wait, as I converted code and divided the poorly-organized C++ into better-organized (although not perfect) C# code.

Today I was ready to refactor code into smaller classes. I had the code converted to C#, and tests to ensure that refactoring would change no functionality, and I was looking at the code... and the changes just came to me. It was a no-brainer, an obvious operation. I was able to separate three sections of code into distinct classes -- but the last class needs a bit of work, given the (ugly) API that it requires. But I am even happy with that, since the API is obviously ugly and a sure sign that a better design is waiting.

No comments:

Post a Comment