“传承深度”是什么意思?方法的意思?

发布于 2024-11-08 23:17:41 字数 481 浏览 0 评论 0原文

我刚刚安装了用于代码分析的 Visual Studio Power Tool 和结果查看器。顺便说一句,很棒的工具!

当我单击“分析解决方案”时,我得到结果:

  • 可维护性
  • 循环复杂
  • 性 继承深度
  • 类耦合
  • 代码行数

我明白这些都意味着什么,除了,“继承深度”有不同的值类中的每个方法,以及该类的较大方法。

有谁能解释一下这可能在说什么吗?

I have just installed the Visual Studio Power Tool for code analysis and the viewer for the results. Great tools, by the way!

When I click "Analyze Solution" I get the results:

  • Maintainability
  • Cyclomatic Complexity
  • Depth of Inheritance
  • Class Coupling
  • Lines of Code

I understand what these all mean, except that there are different values of "depth of inheritance" for each method in a class, and a larger one for the class.

Does anyone have an explanation of what this might be saying?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的呼吸 2024-11-15 23:17:41

由于每个派生类都扩展了前一个类,因此它添加了附加功能。它可以添加先前基类中不存在的属性或方法。现在方法的总数比基类的要大。当派生类再次派生时,可以重复这个过程。

因此,如果您采用最派生的类并选择一个方法 A 并跟踪它直到首先实现 A 的基类,它可能是一个不同的更深< /strong> 类,而不是选择方法 B 并遵循它直到实现 B 的第一个基类。这就是为什么不同方法的继承深度可能不同的原因。

如果你看类本身,它有一系列清晰的基类和自己的清晰深度,与方法的深度无关,这些方法总是与类本身相同或更少。

As each derived class extends the previous class, it adds additional functionality. It can add properties or methods that didn't exist in the previous base class. Now the the total set of methods is larger than it was for the base class. This process can be repeated when the derived class is derived from again.

So if you take the most derived class and pick a method A and follow it down to the base class that first implemented A, it might be a different deeper class than if you pick method B and follow it down to the first base class that implemented B. This is why the depth of inheritance can be different for different methods.

If you take the class itself, it has a clear series of base classes and a clear depth of its own, independent of the depth of the methods, which are always the same or less the class itself.

烟酒忠诚 2024-11-15 23:17:41

这是继承深度的一个很好的解释(带图片!):

http://www.nayyeri.net/depth-of-inheritance-for-wpf-and-windows-forms-applications

Here is a great explanation (with pictures!) of Depth of Inheritance:

http://www.nayyeri.net/depth-of-inheritance-for-wpf-and-windows-forms-applications

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文