开发者

Which is the best tool for finding bugs in the Java code? [closed]

开发者 https://www.devze.com 2023-04-02 14:46 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. 开发者_JS百科 Want to improve this question? Update the question so it can be answered with facts and citations
Closed. This question is opinion-based. It is not currently accepting answers. 开发者_JS百科

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 8 years ago.

Improve this question

I would like to know which tool is best for finding any kind of bugs in my code. I know this may be some what theoretical or never ending question so I would like to modify it in terms of the efficiency of bug reporting (including the naming convention as well). So you can say which tool reports and maximum bugs and if effectively used in the industry? I heard about findbug is it really good?


FindBugs is probably one of the most prominent ones and well worth a try.

For naming conventions etc, I'd suggest you have a look at CheckStyle.


Findbugs is quite good. However, I would recommend using sonar to maintain code quality. http://www.sonarsource.org/ It integrates well with maven (sonar:sonar). Other than this I believe the use of maven site to create checkstyle, pmd, findbugs et-all report also helps keep the developers on toes.


It depends on what you are looking for. Personally, I use a combination of FindBugs and PMD for performing static analysis of Java code. However, I recently discovered an Eclipse plugin called CodePro Analytix by Google.

There are two types of analysis for Java code - source code analysis and byte code analysis. PMD looks at the source code to find possible bugs, unused code, suboptimal code, complicated expressions, and duplicated code. FindBugs looks at the generated byte code to find possible errors. Both are essential when analyzing an application.

However, when it comes to finding defects, nothing beats a good testing framework and (if necessary) a mocking library. I've had good successes with JUnit and Mockito. This will enable you to write unit tests for your modules. Writing code system, integration, and smoke tests, either using automated tools or test procedures is also important so that you can cover core functionality and quickly see when something is broken.


I prefer to use the Code Analysis in IntelliJ. It not only finds many probable bugs and improvement but has quick fixes for a lot them which makes it practical to fix large amounts of code.


use a compiler to find syntax 'bugs'

use test cases to find usability 'bugs'

use test harnesses in the code to find regression issues with code modifications.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号