Calculating Fan in / Fan out of a metrics project

Hey I am in the process of a coding a OOD metrics project. I am 90 percent done I just need a few more metric measurements to add to it, and two of the hard ones are fan in and fan out.

The project consists of a GUI which allows opening of multiple files at a time, so it gets all of the java files in a project then sends each file to the parser. The class parser gets the class information and stores the class name, methods[], attributes[], etc. The method parser parses out the method header into returntype, visibility, name, static?, final?, etc and also saves the code inside of the method block to calculate mccabes number. Then the attribute parser just parses an attribute line into the datatype, visibility, and name. I am just stumped as how to calculate the Fan in/ out of a member function...has anyone out there done something similar? If you need to see some of my code just post that you want me to paste some of it.

[946 byte] By [mchiciaka] at [2007-10-2 18:45:27]
# 1

Fan-out is a count of the entities the current entity touches (calls), fan-in is the a count of the entities that touch (call) the current entity. Conventionally the entity is a function, or module. In Java these could be methods, classes and packages.

However I don't think you could create a _meaningful_ fan-in/out metric for java unless you can answer two questions. 1) How could polymorphic classes be counted and 2) How should factory methods be counted.

I don't have good answers to either question but it would probably a good topic to explore.

MartinS.a at 2007-7-13 20:07:57 > top of Java-index,Other Topics,Algorithms...