Question

If I want to manually calculate the efferent coupling of a .Net class should I include types from the CLR in my calculation, or just types I have created?

Était-ce utile?

La solution

The tool NDepend that calculates the efferent coupling takes account of third-party types used. (Documentation here). Here is a CQLinq code query that shows this fact:

NDepend efferent coupling

Notice that it is possible to recalculate the efferent coupling only for application types used if you wish.

NDepend efferent coupling without third-party

If your goal is to detect if a type has too many responsibilities (which is often the case when a type is using many others types, many means like several dozens) this makes sense to include types from the .NET Fx. For example the usage of types in System.IO or System.Threading clearly indicates a special responsibility for the user type. This is also why for detecting many responsibilities, you could count also the number of namespaces used (including third-party ones)

NDepend efferent coupling, parent namespaces

Disclaimer: I am working in the NDepend team

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top