Examine Your Old Code

I’m starting another OSS project. One of my goals is to cover an existing project – this is something I’ve been meaning to get back to for a while. Essentially it’s an update to a port of Java code I wrote about 9 years ago. About 5 and a half years ago I decided to port it over to C#, .NET. 4 years ago, I ported the UI over to compact framework 1.0, to prove to myself the code was so ‘good’, I could just replace the UI layer of the game and everything would be happy.

And… at that point I added a service layer to keep track of scoring. The funny thing about old code is that it’s always terrible. (At least my personal projects are) I open it up and hoo boy it’s instantly clear that I went about things the wrong way. Many types are in the service reference? Really?

The service code is so tightly coupled it’s making me sweat.

So, I’m about to go all Fowler on this & start refactoring. In fact, it’s so bad, I’ll be a craftsman & start wiping out the dumb classes.

The game’s just a simple modified version of “Same”, that I’d always hoped to modify with a collection of something like IRemovalLogic that could be stacked in wild and crazy ways to provide a unique game experience. But it looks like it’s going to be fun just getting to the starting point.

Tasks to do:

  1. Rip out the service garbage. Put back the fluff later.
  2. Wipe out the UI? Replace w/ WPF? Or am I wasting my time going on a tangent here….
  3. Cover the code!!! NCover is my friend, really.
  4. ILogic – create a second methodology for how the game works.
  5. IScoringMethodology – allow for changing the scoring
  6. Logic via plugin architecture – allow for easy dynamic addition of rules. This will have to include on an itemized basis publishing interfaces to the BO’s.
  7. Open the source (I’ll be moving this way up, once the code’s stable again).
  8. Create an AI. I’m going somewhere w/ this! This is relatively simple for the simple cases… I have yet to determine whether I want to make the AI test the logic, or the logic test the AI…. or both.

Posted on 3/13/2009 7:27:41 PM by Jason Nadal

Permalink | Comments |

Categories:

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
blog comments powered by Disqus