<ul>Improving your Java Code with FindBugs and Checkstyle </ul><ul><li>By Gunith Devasurendra
(A FOSS Activist, A Virtusan, An APIIT Alumni, An Old Royalist and A Programmer) </li></ul>
<ul>Defects! </ul><ul><li>Something wrong in the software
Reason for QA!
A Few Types of Defects in Software </li><ul><li>Requirement Based Defects
Technical Defects
Style Defects (??) </li></ul></ul>
<ul>Technical Defects </ul><ul><li>Anomalies in code
Can be found by reading the pattern of code – Bug Patterns!
Can be automatically found!
Upcoming SlideShare
Loading in …5
×

Java programming with findbugs and checkstyle

3,595 views

Published on

Java programming with findbugs and checkstyle

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,595
On SlideShare
0
From Embeds
0
Number of Embeds
77
Actions
Shares
0
Downloads
60
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Java programming with findbugs and checkstyle

  1. 1. <ul>Improving your Java Code with FindBugs and Checkstyle </ul><ul><li>By Gunith Devasurendra
  2. 2. (A FOSS Activist, A Virtusan, An APIIT Alumni, An Old Royalist and A Programmer) </li></ul>
  3. 3. <ul>Defects! </ul><ul><li>Something wrong in the software
  4. 4. Reason for QA!
  5. 5. A Few Types of Defects in Software </li><ul><li>Requirement Based Defects
  6. 6. Technical Defects
  7. 7. Style Defects (??) </li></ul></ul>
  8. 8. <ul>Technical Defects </ul><ul><li>Anomalies in code
  9. 9. Can be found by reading the pattern of code – Bug Patterns!
  10. 10. Can be automatically found!
  11. 11. 2 Tools for capturing Java tech defects </li><ul><li>FindBugs – A static analysis tool
  12. 12. PMD – A dynamic analysis tool </li></ul></ul>
  13. 13. <ul>FindBugs </ul><ul><li>An Open Source Project by The University Of Maryland
  14. 14. Distributed under the terms of the Lesser GNU Public License </li></ul><ul><li>http://findbugs.sourceforge.net </li></ul>
  15. 15. <ul>Bugs @ FindBugs </ul><ul><li>Categorizes more than 300 bug types
  16. 16. Every bug has a priority rating: </li><ul><li>High –> P1
  17. 17. Medium -> P2
  18. 18. Low -> P3 </li></ul><li>Every bug has a Category, such as such as &quot;Malicious Code,&quot; &quot;Bad Practice,&quot; and &quot;Performance.&quot;
  19. 19. Full List: http://findbugs.sourceforge.net/bugDescriptions.html </li></ul>
  20. 20. <ul>Checkstyle </ul><ul><li>Automate Coding standards: </li><ul><li>to maintain code consistency across teams and the times
  21. 21. Ensure better coding practices </li></ul><li>Use </li><ul><li>Sun Coding Standard OR
  22. 22. Can be customized to suit your project’s coding standard </li></ul><li>http://checkstyle.sourceforge.net/ </li></ul>
  23. 23. <ul>Checkstyle Defects </ul><ul><li>Comments: Javadoc
  24. 24. Naming conventions: Class names, Var names, Constants
  25. 25. Indentation: Spaces over tabs
  26. 26. Declarations:
  27. 27. Statements:
  28. 28. Best practices: </li><ul><li>Use the final keyword for variables and parameters that will not need to be modified.
  29. 29. Don't declare variables within loops </li></ul></ul>
  30. 30. <ul>Advantages of using Code Analysis Tools </ul><ul><li>Understand Errors Early, before our client does
  31. 31. Helper for Code Reviewers
  32. 32. Learning Best Practices </li></ul>
  33. 33. <ul>Demo </ul>
  34. 34. <ul>Links4U </ul><ul><li>http://findbugs.sourceforge.net
  35. 35. http://checkstyle.sourceforge.net/
  36. 36. http://www.devx.com/Java/Article/38735/1954
  37. 37. http://www.devx.com/architect/Article/31071/0 </li></ul>

×