Tuesday, March 15, 2005


silly name right?

That legacy c++ app I inherited had such a class in it. Today I finally got fed up with seeing that silly name and decided to rename it to something rather more meaningful. So I did a search through the source for an instance of the object; lo and behold, it's not used anywhere! Ok, so delete the files from the project workspace, recompile and voila! Well, one thing led to another and 2 hours later I've removed at least 20 unused classes. The release build of the app dropped from about 1.2 Meg to 950 K. Not bad.

The less experienced amongst you might be wondering why it's taken me 9 months to do this (today is my 9 month anniversary with the company). The more experienced already know .

There is more than 1 reason. The first reason is that until relatively recently this has been a 'new' app to me. If the release build of the binary comes out at over a meg that implies a fair sized app and a codebase which, whilst not enormous, certainly isn't trivial either. And only a fool goes in and starts condemning large lumps of code without taking a long and careful look.

I've made no secret of the fact that I'm monumentally unimpressed with the code quality. On the other hand, it does work, however inefficiently. I'm not only maintaning the app, I'm adding new functionality as requested by our customer and I don't want to go in and break things just for the sake of making the code conform to MY ideas of how it should be written. I've got better things to do than arbitrarily replace X with Y just because I don't like X.

To put things into perspective; the part of the product I work on consists of 2 main executables. One is the user interface; the other is the runtime. The UI and the runtime communicate via out-of-proc COM. There are another dozen or so DLL's. All up it's probably about 600 source files and maybe half a million lines of code; most of it uncommented. This is one of the few bodies of code I've seen where a raw linecount really does approximate a true count of lines of code!

No comments: