gpt4 book ai didi

java - PMD 5.4.2 中可能存在上帝类别违规

转载 作者:行者123 更新时间:2023-11-30 07:19:34 30 4
gpt4 key购买 nike

JAVA代码使用PMD 5.4.2,发现一些与Possible God Class相关的违规行为,如下所示:

Possible God class (WMC=69, ATFD=65, TCC=0.03218390804597701)

我不想抑制这些警告。那么谁能解释一下,解决此违规问题的最佳解决方法是什么。

感谢您的解释。

最佳答案

来自http://pmd.sourceforge.net/pmd-5.0.1/rules/java/design.html

The God Class rule detects the God Class design flaw using metrics. God classes do too many things, are very big and overly complex. They should be split apart to be more object-oriented. The rule uses the detection strategy described in "Object-Oriented Metrics in Practice". The violations are reported against the entire class. See also the references: Michele Lanza and Radu Marinescu. Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems

以及更多有关如何重构上帝类的内容,请阅读 How do you refactor a God class?

关于java - PMD 5.4.2 中可能存在上帝类别违规,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37805827/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com