So the team I work with has inherited a project that seems to never end. The aggravation level of everyone and having to touch this code is at an all-time level because nothing is simple when working with it. I constantly ask myself WTF, and Why? I know the people who wrote the code are pretty good programmers so I wonder why it became this way. I later reflect that maybe they took all the bad code that was written in VB6 and just slapped it into a class in VB.Net and made all the code COM visible so the legacy code could use it.
I read in a magazine one time about why we call code "legacy code". What's the difference between code written today and "legacy code"? Well, "legacy code" is code nobody wants to touch anymore either because it's too complex, lack of documentation, or lack of unit tests to support old ideas. Below are some metrics of this code using Reflector. I was shocked when I saw them!
Type metrics showing complexity per class type. Complexity should be around 15 or less to be considered quality maintainable code.
Type metrics showing the number of lines of code. That's a lot!
Now the good stuff. Metrics by method showing the method complexity. Again should be around 10 to 15 for good quality code.
Lines of code per method. You can see that's a lot of code for a single method. You could probably split the first one into about 15 to 20 classes.
I saved the best for last. Metrics by module which is a single file. I only included the dlls and did not include any of the exe files. 9 million lines of code in a single dll. Windows 3.1 had between 4 and 5 million lines of code and that was a whole operating system. Total in all, the files they wrote, probably equal the same number of lines of code as it took to write Windows 2000.
Now as a developer, where do you start? Do you just say screw it and start over? Do you just keep putting Band-Aides on it and hope you can make something better in the mean time?
Right now I'm thinking 85 to 90% of the code isn't even used. Now I need to figure out how to isolate the code that isn't used between various .Net and vb6 projects and then loading all the sub-projects into source control correctly using branches and trunks so when a user checks in a small change it doesn't destroy everything.
WARNING! Aggravation level is extremely high!
Wednesday, June 24, 2009
Tuesday, June 23, 2009
Coining some vb terms
So yesterday or the day before I came with an idea to classify vb code into a term people like saying. It seems that if a language doesn't have .net or .blah on it then people think it's old or eclectic. There are about 4 different forms of vb and I use them all weekly so I've coined some terms to separate them all so that people always understand what form of the vb language I am talking about.
VB 4/5/6 - VB.Classic or VB#
VBScript - VB.Script
VBA - VB.App or VB.Applications
VB.Net - VB.Net or VB.Net #.#
VB 4/5/6 - VB.Classic or VB#
VBScript - VB.Script
VBA - VB.App or VB.Applications
VB.Net - VB.Net or VB.Net #.#
Subscribe to:
Posts (Atom)