Jaa


Confessions of a C# Hack

I've been making a lot of changes lately to the c# compiler.  You won't see these in Whidbey so don't ask me about them yet.  For the most part, it hasn't been too tough.  The compiler was designed well and is generally easy to make modifications too.  Yet eventually I hit a wall trying to get the compiler to do something it was not designed to do.  That's when thoughts start racing through my head, “if I had designed this I would have done it differently; yada yada yada.“  I start imagining what it would be like if I actually did re-architect the whole thing.  After all, I'm used to throwing out my own code and starting over.  I do it all the time.  But something is different when you are working on an established codebase.  Especially, if it has already shipped.

In truth, the changes would probably be overwhelming and the impact on the product too huge to consider.  The prudent thing to do would be to find a way to wedge the new behavior in.  That's what I've been doing, and its often not pretty.  I get rather flippant sometimes and refer to these changes as 'hacks', though that usually carries an extreme negative connotation, which is not really the truth.  It is just my own dissatisfaction showing through, not want to let go of the dream of the perfect design. 

At least I console myself with the thought that if we do one day embark on the mission to rewrite the compiler from scratch, I will have learned a lot about how the new compiler should be designed.

Matt

Comments

  • Anonymous
    July 20, 2004
    Hey Matt. I understand the dilema as often it happens here likewise. But consider this: When you approach a problem in code design is it because the design is wrong/broken/whatever and cannot be extended or is it just that you do not understand it? Often I witnessed people re-writing sections of code that they didn't understand. Especially scary when people favor custom written classes over standard system library classes. I completely agree with you note (with many smiles and grins) but also don't throw out the baby with the bath water. Key here is to learn and store up the experience to write better when given the opportunity right?

    Thanks for hearing me out
  • Anonymous
    July 20, 2004
    I hear that "Refractoring" or whatever is what you need.
  • Anonymous
    July 20, 2004
    The comment has been removed