Java工具,以改善我的清洁代码开发 [英] Java tool to improve my Clean Code Development

查看:102
本文介绍了Java工具,以改善我的清洁代码开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有针对Java的任何(静态分析/重构/ ...)工具专门针对 清洁代码开发(CCD)



我知道静态分析(PMD,Findbugs,Checkstyle),依赖注入,测试和代码覆盖的常用工具。但我正在寻找一种工具,可以提示我的代码是如何干净的(如此处所述)并且在鲍勃叔叔的清洁代码中),我怎样才能让它更干净,最好是适应我的 清除代码等级 。一个工具也可以告诉我如何随着时间的推移改进CCD。



这样一个工具的一个例子是 CcdAddIn ,根据您当前的CCD等级显示CCD值,但仅适用于visual studio :(



那么你知道Java的这些工具吗?哪一个是最好的?它们完成了以上哪些工作?或者你有理由不存在这样的工具吗?






如果您不知道这样的工具:您是否知道可以配置为检查标准的静态分析工具在鲍勃叔叔的清洁代码中给出,例如警告我有关名字或评论的气味似乎是选择严重,方法太长或参数太多,并立即建议一个特定的重构来解决这个问题?

解决方案

Sonar 预设了一些不错的代码质量配置文件 - 基于PMD,Checkstyle和Findbugs - 一个很好的界面,可以自定义它们供您自己使用。我不认为你会在Java世界中找到一个你应该......的通用列表。这种统一性有太多不同的应用和开发方法。如果您查看预定义的 PMD规则集,您甚至可以找到一组有争议的规则,特别是那些倾向于引发激烈辩论的规则。有些人喜欢他们;有些人讨厌他们。因此,这里的第一个道德是使用已建立的约定作为指导并根据需要添加/删除。



我从来没有听说过Java领域的CCD,所以我不希望找到直接的翻译。如果你关心健康(干净?)代码,你必须使用像Sonar这样的工具或者它编译成一个方便界面的所有工具。声纳不仅仅是静态分析。有一个Sonar的演示实例,您可以在其中了解其功能以及对指标的反恐一些开源库。所以第二个道德就是使用声纳因为它太棒了。


Are there any (static analysis / refactoring / ...) tools for Java specially tailored towards clean code development (CCD)?

I know of the usual tools for static analysis (PMD, Findbugs, Checkstyle), dependency injection, testing and code coverage. But I am looking for a tool that gives me hints how clean my code is (as described e.g. here and in Uncle Bob's Clean Code), how I can make it cleaner, preferably attuned to my clean code grade. A tool that could also show me how I am improving in CCD over time would be optimal.

An example of such a tool is CcdAddIn, which displays the CCD values according to your current CCD Grade, but its only for visual studio :(

So do you know such tools for Java? Which one is best? What of the above do they fulfill? Or do you have a reason why such a tool does not exist (yet)?


If you do not know of such a tool: Do you know of a static analysis tool that can be configured to check for the criteria given in Uncle Bob's Clean Code, e.g. warn me about smells like names or comments seeming to be chosen badly, methods that are too long or have too many parameters, and immediately suggest a particular refactoring to resolve this?

解决方案

Sonar comes preset with some decent code quality profiles--based on PMD, Checkstyle, and Findbugs--and a nice interface for customizing them for your own use. I don't think you're going to find one, universal list of "Thou shalt..." in the Java world. There are too many different applications and development approaches for that kind of uniformity. If you take a look at the predefined PMD rule sets, you'll even find a set of "Controversial Rules" which are specifically ones that tend to engender heated debates. Some love them; some hate them. So the first moral here would be to use established conventions as guidelines and add/remove as you see fit.

I've never heard of CCD in Java land, so I wouldn't expect to find a direct translation. If you care about healthy (clean?) code, you must use a tool like Sonar or else all of the tools that it compiles into one, convenient interface. Sonar does much more than just the static analysis. There's a demo instance of Sonar where you can get an idea of its features as well as recoil in horror at the metrics of some open source libraries. So the second moral would be, "Use Sonar because it's awesome."

这篇关于Java工具,以改善我的清洁代码开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆