ReportCohesion

Produce a html, etc. report for a cohesion analysis.

Process a dgml file generated from a cohesion analysis.

Expected usage: DeepEnds ReportCohesion <options> filenames
<options> available:
      --output               Required. Path for writing HTML (*.html|*.htm),
                               markdown (*.md), source for doxygen (*.cs, etc.) or the main table
                               (*.csv) containing various statistics
      --split                Default(false). Whether to split the report into
                               multiple files. Values are true and false

Examples:
  DeepEnds ReportCohesion --split=true --output=C:\Results\Cohesion\split.cs C:\Source\cohesion.dgml
      - read a cohesion graph and create a set of C# files in C:\Results\Cohesion for doxygen
  DeepEnds ReportCohesion --output=C:\Results\cohesion.csv C:\Source\cohesion.dgml
      - read a cohesion graph and create a table
  DeepEnds ReportCohesion --output=C:\Results\cohesion.html C:\Source\cohesion.dgml
      - read a cohesion graph and create a html report
  DeepEnds ReportCohesion --output=C:\Results\cohesion.md C:\Source\cohesion.dgml
      - read a cohesion graph and create a markdown report

Having created a DGML file using a tool for reading the source code with extract set to cohesion this tool then post-processes it.

Example output follows


The following sections refer to the individual sections for each level.

Table

The table is grouped by columns. The summary table is sorted on the value of P (the number of parts), subsequent instances are sorted on the section name.

N.B. Any low scores on the cohesion values may be due to dependency inversion. i.e. May indicate good design.

Section

The node label of the graph (with the obvious exception of “Top level”).

Cycle

If a cycle in the graph (circular dependency) occurs then the word cycle will appear as the value otherwise it is left blank.

Parts (P)

For cohesion there should be only one part to the graph.

Parts divided by nodes (P/N)

The value varies between 0 and 1, the upper bound indicating that the class is either a collection of unrelated pieces or exists to inject dependencies.

Parts with more than one node (P’)

A better measure of cohesion than parts as it strips away those pieces finding a convenient location.

Structure Matrix

The structure matrix represents the dependency of one node upon another in the level. To work out what a node depends on read along a row until the value of 1 is encountered then read vertically to the diagonal (represented by a backslash). The row containing that diagonal is the corresponding dependency.

The rows of the matrix have been sorted in the attempt to ensure that the 1’s are below the diagonal. If this is not the case then a cycle exists in the corresponding graph. i.e. a circular dependency exists.

Summary of graph complexity

Table

The following table is sorted on the value of P, subsequent instances of this table type are sorted on the section name.

Section Cycle P P / N P’
    Max / Val Max / Val Max / Val
DeepEnds.CInclude.Snippet   19 1.00 0

DeepEnds.CInclude.Snippet

Table

Section Cycle P P / N P’
    Max / Val Max / Val Max / Val
DeepEnds.CInclude.Snippet   19 1.00 0

Structure Matrix

Dependency                                      
AccessSpecifier \                                    
HasOverride   \                                  
HasAbstract     \                                
NumLines       \                              
NameSpace         \                            
ContainsName(string)           \                          
FullName()             \                        
GetBases()               \                      
GetCalls()                 \                    
GetClasses()                   \                  
GetConstructorsAndDestructors()                     \                
GetFields()                       \              
GetMethods()                         \            
GetNamespaces()                           \          
GetOthers()                             \        
Name()                               \      
References()                                 \    
SourceProvider()                                   \  
AlwaysUsed()                                     \