[dba-Tech] Cyclomatic Complexity of real life projects

Salakhetdinov Shamil mcp2004 at mail.ru
Fri Jul 11 05:03:41 CDT 2014


 Hi All --

I have used the SourceMonitor program ( http://www.campwoodsw.com/sourcemonitor.html ) to calculate Cyclomatic Complexity ( http://en.wikipedia.org/wiki/Cyclomatic_complexity ) for two sets of my customers' C# projects' suites totaling 60 solutions and 293 projects, I guess about 15% of the sources are legacy, the rest has been developed from scratch here since the summer 2007. Only *.cs files were analyzed (*.designer.cs, *.aspx were skipped, SQL Server and MS Access databases were not analyzed et all etc.) The stats are in P.S. of this posting.

It's interesting to note that the following stats:

Avg. Depth = ~ 2.40
Avg.Complexity = ~ 2.20
Methods/Class = ~8
Calls/Method    = ~2.4 
Stmts/Method =  ~6

(please check if I'm not mistaken)

seems to be "constant" for both sets. So they could be considered as a "signature" of a developer? 
Or are they "custom software development industry" overall average?
Could you please try to post your projects' stats and/or average "signatures"? - it doesn't matter will they be C# or VB(.NET) or VBA or .py ...

Yes, I know the code base stats I'm posting are far from being perfect but that is the real code used in the real life projects, which are currently driving real businesses.
BTW, in what money sum would you evaluate the costs of creating and supporting such a code base?

Thank you.

-- Shamil


P.S. The stats:

1st:
====
Solutions(.sln): 48 
Projecs(.csproj): 259
Files: 4555 
Lines: 952,234 
Statements: 418,009 
% Comments: 14.1 
% Docs: 6.5 
Classes: 5,480 
Methods/Class: 9.39
Calls/Method: 2.33
Stmts/Method: 5.37
Max Complexity: 265
Max Depth: 9+ 
Avg Depth: 2.40
Avg Complexity: 2.21

2nd:
====
Solutions(.sln): 12
Projecs(.csproj): 34
Files: 1680 
Lines: 351,624* 
Statements: 188,580 
% Comments: 10.9 
% Docs: 12.5 
Classes: 3,030 
Methods/Class: 6.68 
Calls/Method: 2.48 
Stmts/Method: 6.91 
Max Complexity: 113* 
Max Depth: 9+ 
Avg Depth: 2.28 
Avg Complexity: 2.17*
======================
Total Solutions(.sln): 60
Total Projecs(.csproj): 293



-- 
Салахетдинов Шамиль


More information about the dba-Tech mailing list