Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cutting down on the number of public classes in my .NET application?

Tags:

.net

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?

like image 819
Roger Lipscombe Avatar asked Sep 20 '10 15:09

Roger Lipscombe


3 Answers

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

like image 122
Iain Avatar answered Oct 13 '22 19:10

Iain


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.

like image 4
Randolpho Avatar answered Oct 13 '22 18:10

Randolpho


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. ;)

like image 1
Kris Krause Avatar answered Oct 13 '22 20:10

Kris Krause