WorldofASP.NET : ASP.NET Directory, Tutorial, Hosting, and Source Code
You are 1 of 137 users


Code Metrics - Complexity & The .NET Framework...

Blogger : ASP.NET Blogs
All posts : All posts by ASP.NET Blogs
Category : XML
Blogged date : 2007 Feb 14

 

If you have never heard of "Cyclomatic Complexity" a good place to start is here. I decided to grab the Reflector Addin by Peli which will examine an assembly's methods and produce a list of code metrics for each given method, one of which is the Cyclomatic Complexity and run it on "mscorlib.dll" and some of the results are actually quite alarming.

Just in this one DLL there are 24 methods that score 50 or higher, the highest being DateTimeParse.ParseByFormat() which scores at 98.  Now if you look at Table 4 in the article I linked above you will notice that they state that "greater than 50 - untetsable program (very hight risk)"

I would love to see the code coverage report on these methods.  How much of these top methods are actually being testing?  How thorough is their process for getting these "untestable" methods tested.  I would also like to see the number of bug reports for each method > 50 in the framework and compare those to those < 50...

 

I decided to dig a bit deeper than just mscorlib.dll.  Here are some of the things I found...

System.dll  has 20 methods > 50 with the worst at 178

    HttpRequestCacheValidator.FetchCacheControl(String, Boolean) : Void 

 

System.Data.dll has  14 methods > 50 with the worst at 118

     BinaryNode.EvalBinaryOp(Int32, ExpressionNode, ExpressionNode, DataRow, DataRowVersion, Int32[]) : Object 

 

System.Drawing.dll has NO methods > 50, with the worst at 29

    Icon.Initialize(Int32, Int32) : Void

System.Web.dll has 19 methods > 50, with the worst at 184

    BrowserCapabilitiesFactory.UpProcess(NameValueCollection, HttpBrowserCapabilities) : Boolean 

 

System.Windows.Forms.dll has 35 methods > 50, with the worst at 169

    DataGridView.GetClipboardContent() : DataObject

 

System.Configuration.dll has 3 methods > 50, with the worst at 89

    ConfigurationElement.DeserializeElement(XmlReader, Boolean) : Void

 

System.Security.dll has NO methods > 50, with the worst at  35

    Reference.CalculateHashValue(XmlDocument, CanonicalXmlNodeList) : Byte[]

 

and the all time worst method for Cyclomatic Complexity is...

 

System.Xml.dll has 15 methods > 50, with the worst at 224

    XmlSchemaInference.InferSimpleType(String, Boolean&) : Int32

 
Also, it has 1557 instructions, 31 locals..

How can anyone test this accurately?

 


Read comments or post a reply to : Code Metrics - Complexity & The .NET Framework...
Page 1162 of 1973
Next | Last

.NET News Categories








Legend : - Within 3 Days - Within 6 Days - Within 9 Days

Home | Add Resources | Sponsored Listings | Advertise with Us | SiteMap 1 | SiteMap 2 | Link To Us | Contact Us
© 2002-2008 Worldofasp.net ASP.NET Directory, Hosting and Tutorials | All rights reserved
Our Partners : ASP.NET Web Hosting | Windows Web Hosting | ASP.NET Hosting | Phone Card | PHP Directory | Bangkok Hotels |Calling Card