SubMain - CodeIt.Right The First Time!

/Community

A Support Community for SubMain Products
 Home Products Services Download Purchase Support
in Search
 
Home Forums Blogs Tutorials Downloads
Welcome to SubMain Community Sign in | Join | Help

Metrics Resources

Last post 12-01-2009, 7:25 AM by MarkJerde. 2 replies.
Sort Posts: Previous Next
  •  11-25-2009, 5:39 PM 979

    Metrics Resources

    Hello.  I looked in the CodeIt.Right help file, on the site and searched this forum.  I didn't find any information about what the various metrics mean.  Are there resources for learning about the metrics so I can make better use of this part of CodeIt.Right?  Thanks.

        -- Mark

  •  11-30-2009, 11:13 PM 994 in reply to 979

    Re: Metrics Resources

    Hi Mark,

    Below is description for Cyclomatic Complexity and Depth of Inheritance. Other metrics are very much self explanatory - please let me know if  you need details on any specific on of them.

    • Cyclomatic Complexity (CC) - a popular procedural software metric equal to the number of decisions that can be taken in a procedure. It is created by calculating the number of different code paths in the flow of the program such as if blocks, switch cases, and do, while, foreach and for loops then adding 1 to the total. Methods with CC 10-15 and higher are hard to understand and maintain - recommended to refactor. Methods with CC 25+ are extremely complex and must be split in smaller methods - Extract Method - with the exception perhaps for the auto-generated code when you have very little control. For more information on this metric see http://en.wikipedia.org/wiki/Cyclomatic_complexity

    • Depth of Inheritance (DI) - indicates the number of class definitions that extend to the root of the class hierarchy. The deeper the hierarchy the more difficult it might be to understand where particular methods and fields are defined or/and redefined. Depending on product type, technology and team accepted standards max DI value ranges between 4 and 6, types with higher DI would compromise encapsulation and increase complexity. However when deriving from BCL or other complex framework classes the accepted DI value may be higher since the base class DI is already high enough.


    Thank you,
    Serge Baranovsky
    http://submain.com - .NET Developer Tools  |  Microsoft VB MVP  |  http://vbcity.com - VB Developer Community
    » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right
    » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
  •  12-01-2009, 7:25 AM 996 in reply to 994

    Re: Metrics Resources

    Serge -- Thanks for the short, concise explanations.  I have several ideas/suggestions but don't have time to organize & write them now.  Let me briefly describe the "highest level" and maybe you will reply, "Yes we are working on that."  Wink    ... or maybe, "It already does that.  From the ___ menu choose ____ then ...."  Smile

     I think it would be great if CodeIt.Right would do with "Metrics" similar to what it does with code analysis.  If a metric is over a threshold specified in the selected "Metrics Rules" the CodeIt.Right GUI indicates this.  Like code analysis, the user is just a click away from helpful information.  Exclusions can be applied at the file level because sometimes the only reasonable way to do something, like a message pump, is with a huge switch.  I don't know enough about Depth of Inheritance to know if this makes sense, but ISTM that DI(JustMyCode) could be nice.

    It would be nice if there were configurable rules for "Is this chunk of code documented well enough?"  These are some of the factors:

    • Blank lines
    • Code lines
    • Comments appended to lines of code (I like these, they save screen space)
    • Comment lines that appear to be real comments
    • Comments that appear to be commented-out code
    • The "block of code" the comment(s) apply to

    Here are some sample rules:

    • Fail if 5% or more "commented-out code" comments
    • Fail a file that doesn't have "real comments" associated with each "major block of code".  I.e., Methods, If statements with more than ____ lines, loops with more than ____ lines, etc.
    • Fail if < 10% comments
    • Fail if no header
    -- Mark

     

View as RSS news feed in XML
 
     
 
Home |  Products |  Services |  Download |  Purchase |  Support |  Community |  About Us |