Implementing Quality on Java projects (Short version)

639 views

Published on

Gives 3 hands on tips on how to improve a specific aspect of Quality on Java projects

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
639
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Implementing Quality on Java projects (Short version)

  1. 1. Implementing Quality in Java
  2. 2. Vincent Massol ● Speaker Bio ● CTO XWiki SAS ● Your Projects ● XWiki (community-driven open source project) ● Past: Maven, Apache Cargo, Apache Cactus, Pattern Testing ● Other Credentials: ● LesCastCodeurs podcast ● Creator of OSSGTP open source group in Paris ● 3 books: JUnit in Action, Maven: A Developer’s Notebook, BBWM
  3. 3. What is quality ?
  4. 4. The XWiki project
  5. 5. Examples of Quality actions ● Coding rules (Checkstyle, ...) ● Test coverage ● Track bugs ● Don’t use Commons Lang 2.x ● Use SLF4J and don’t draw Log4J/JCL in dependencies ● Automated build ● Automated unit tests ● Stable automated functional tests ● Ensure API stability ● Code reviews ● License header checks ● Release with Java 6 ● Ensure javadoc exist ● Prevent JAR hell ● Release often (every 2 weeks) ● Collaborative design ● Test on supported environments (DB & Browsers)
  6. 6. Quality Tip #1 API Stability
  7. 7. Using CLIRR <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>clirr-maven-pluginclirr-maven-plugin</artifactId> <configuration> <ignored> <difference> <differenceType>7006</differenceType> <className>org/xwiki/.../MetaDataBlock</className> <method>org.xwiki....block.Block clone()</method> <to>org.xwiki.rendering.block.MetaDataBlock</to> <justification>XDOM#clone() doesn't clone the meta data</justification> </difference> ...
  8. 8. CLIRR Report
  9. 9. Internal Package + AspectJ
  10. 10. Quality Tip #2 Test Coverage
  11. 11. Test Coverage Strategy ● When devs add code (and thus tests), increase the TPC percentage ● Put the Jacoco check in “Quality” Maven Profile ● Have a CI job to execute that profile regularly ● About 15% overhead compared to build without checks ● “Cheat mode”: Add easier-to-write test
  12. 12. Use Jacoco to fail the build <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-pluginjacoco-maven-plugin</artifactId> <executions> <execution><id>jacoco-prepare</id> <goals><goal>prepare-agentprepare-agent</goal></goals> </execution> <execution><id>jacoco-check</id> <goals><goal>checkcheck</goal></goals> </execution> </executions> <configuration> <check> <instructionRatio>${xwiki.jacoco.instructionRatio}${xwiki.jacoco.instructionRatio}</...> </check>}
  13. 13. Quality Tip #3 Bug Fixing Day
  14. 14. BFD Strategy ● Every Thursday ● Goal is to close the max number of bugs ● Triaging:Can be closed with Won’t fix, Duplicate, Cannot Reproduce, etc ● Close low hanging fruits in priority ● Started with last 365 days and currently with last 1500 days (we need to catch up with 80 bugs!)
  15. 15. Results
  16. 16. Conclusion ● Slowly add new quality check over time ● Everyone must be on board ● Favor Active Quality (i.e. make the build fail) over Passive checks ● Be ready to adapt/remove checks if found not useful enough ● Quality brings some risks: ● Potentially less committers for your project (especially open source) ● Project seen as “less fun”
  17. 17. Be proud of your Quality ! “I have offended God and mankind because my work didn't reach the quality it should have.” Leonardo daVinci, on his death bed

×