tags:

views:

103

answers:

4

I'm concerned that a lot of the classes in my application are public. I figure that the majority of them don't need to be.

Are there any tools that can analyse my project (or the binary) and tell me which classes can safely be made internal?

+5  A: 

NDepend will make sugestions, and much more , does a lot of code analysis.

Iain
But does it have a report (I'm thinking FxCop- or ReSharper-like) that specifically says: "these classes do not appear to be used outside this application, and can probably be made internal"?
Roger Lipscombe
yes, under the encapuslation section of the CQL queries, is give you a list of your classes the could be changed 'Types that could be declared as private".This is an old post but the author explains what he is try to do.http://codebetter.com/blogs/patricksmacchia/archive/2007/10/31/optimal-encapsulation.aspx
Iain
+4  A: 

Yes, NDepend and the Visual Studio Dependency Graph generator.

Edit:
That said, I think Kim Jing's deleted post had an excellent suggestion: although the tools will tell you what classes are and aren't used outside your library, it's really something you should do manually wearing your Solution Architect hat.

Randolpho
+1  A: 

NDepend is a good place to start. http://www.ndepend.com/

However, in an ideal world having specific client interfaces public interface I think is the way to move forward as these would be your "pinch points".

Interface segregation principle -

http://en.wikipedia.org/wiki/Interface_segregation_principle

Of course you can always find out in a non-production environment by making everything non public. ;)

Kris Krause
A: 

The fact that you are looking to make classes internal suggests that you should consider breaking the solution up into a library containing the classes that you want hidden away, and an interface containing the classes that you would leave public

Mark Dickinson