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

5

7

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?

Austinaustina answered 6/9, 2011 at 14:9 Comment(4)
Use the one situated between your ears, that's the most potent one and is not replaceable by any machine tools ;-)Juglandaceous
@Peter nice comment... but sometime it dont seems practical specially when you are just a starter... these tool will help you to increase your database of tool named as brain which can be used later.... findbug improved my coding practice a lot.Austinaustina
Indeed. But unless you actually learn why the specific FindBugs warnings are issued and how to avoid them, i.e. how to write better code (for which you must use your brains), you won't become a better developer, no matter how many code analysis tools you use.Juglandaceous
@peter i do agree to that peter and respect your commentAustinaustina
O
10

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.

Oosperm answered 6/9, 2011 at 14:9 Comment(1)
Yes I have used find bugs but we dont have any bug for style. Going through check style let me try that as well.Austinaustina
B
3

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.

Braun answered 6/9, 2011 at 14:10 Comment(0)
R
2

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.

Ruthannruthanne answered 6/9, 2011 at 14:22 Comment(0)
A
1

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.

Authoritarian answered 6/9, 2011 at 14:12 Comment(2)
does it also shows standard naming convention as well?Austinaustina
Standard naming conversions with quick fixes as well. i.e. if a public static final is in camelCase, it highlights (or it appears in a report) and gives you the option to rename it to UPPER_CASE changing all the references (even in comments, String and files)Authoritarian
C
0

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.

Concentrate answered 6/9, 2011 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.