Reputation: 13112
I am currently working on (inherited) a very large ASP.NET MVC application (hundreds of classes, thousands of methods). I'm struggling to understand the system because its become so complicated. Because I can't understand it I'm also struggling to develop it. I'd like to reorganise the code so it's easier to understand and develop.
One thing I've noticed is that there are many (possibly hundreds) of private methods/functions used just once. These private methods often take 10+ parameters. When I've moved the functionality of the private methods into the calling function it makes the code much simpler.
What I'd like to do is find all private methods, and possibly public methods, that are used once. Is this possible? What would be ideal would be to generate some sort of report that shows the usage counts for every method in the system.
Upvotes: 1
Views: 64
Reputation: 75
I don't think you can do this within Visual Studio. It would be very cool though!
The only thing I can think of is to use a tool like NDepend that has code querying funcionality. Take a look at: http://www.ndepend.com/features/cqlinq#CQL
Edit: I just checked and with NDepend you can do:
from m in Application.Methods
where m.NbMethodsCallingMe == 1
select m
Upvotes: 1