White Box Testing
Test your code
   Home      information flow metrics

Information Flow metrics (Henry’s and Kafura metrics)

Counts the number of local information flows entering (fan-in) and exiting (fan-out) each procedure. Thus for a module complexity can be defined as
c = [ procedure length] * [ fan-in * fan-out]2
This metrics helpful in measuring coupling between files, procedure or objects.

Fan-in and Fan-out

Fan-in and fan-out metrics measures design time structure complexity and used for defining maintainability. Fan-in and fan-out measurement can be defined for files, procedure and object.
To better understand visualize it as graph by taking module (file, procedure or node) as node and call between them as edges.
Fan-in of a module is the number of other modules calling to this module directly.
Fan-out of a module is the number of other modules immediately called by this module.

In this example module A has Fan-in = 3 and fan-out = 2
High fan-in shows better design structure. Higher fan-in means this module has been used heavily, this shows re-usability of module and thus reduces redundancy in coding.
Fan-out indicate coupling between modules. High fan out means highly coupled module. High fan-out indicates module depends highly on other module and thus shows poor design structure.
High fan-out also increases maintainability cost. Any changes in module require seeing other modules and thus increases maintainability cast see in following example.
External References