Java programming with findbugs and checkstyle

download Java programming with findbugs and checkstyle

If you can't read please download the document

description

Java programming with findbugs and checkstyle

Transcript of Java programming with findbugs and checkstyle

  • 1.
    • Improving your Java Code with FindBugs and Checkstyle
    • By Gunith Devasurendra
  • 2. (A FOSS Activist, A Virtusan, An APIIT Alumni, An Old Royalist and A Programmer)

3.

  • Defects!
  • Something wrong in the software

4. Reason for QA! 5. A Few Types of Defects in Software

  • Requirement Based Defects

6. Technical Defects 7. Style Defects (??) 8.

  • Technical Defects
  • Anomalies in code

9. Can be found by reading the pattern of code Bug Patterns! 10. Can be automatically found! 11. 2 Tools for capturing Java tech defects

  • FindBugs A static analysis tool

12. PMD A dynamic analysis tool 13.

  • FindBugs
  • An Open Source Project by The University Of Maryland

14. Distributed under the terms of theLesser GNU Public License

  • http://findbugs.sourceforge.net

15.

  • Bugs @ FindBugs
  • Categorizes more than 300 bug types

16. Every bug has a priority rating:

  • High > P1

17. Medium -> P2 18. Low -> P3 Every bug has a Category, such as such as "Malicious Code," "Bad Practice," and "Performance." 19. Full List:http://findbugs.sourceforge.net/bugDescriptions.html 20.

  • Checkstyle
  • Automate Coding standards:
  • to maintain code consistency across teams and the times

21. Ensure better coding practices Use

  • Sun Coding Standard OR

22. Can be customized to suit your projects coding standardhttp://checkstyle.sourceforge.net/ 23.

  • Checkstyle Defects
  • Comments: Javadoc

24. Naming conventions: Class names, Var names, Constants 25. Indentation: Spaces over tabs 26. Declarations: 27. Statements: 28. Best practices:

  • Use the final keyword for variables and parameters that will not need to be modified.

29. Don't declare variables within loops 30.

  • Advantages of using Code Analysis Tools
  • Understand Errors Early, before our client does

31. Helper for Code Reviewers 32. Learning Best Practices 33.

  • Demo

34.

  • Links4U
  • http://findbugs.sourceforge.net

35. http://checkstyle.sourceforge.net/ 36. http://www.devx.com/Java/Article/38735/1954 37. http://www.devx.com/architect/Article/31071/0