Michał Kordas
Blazing Fast Feedback Loops
in the Java Universe
FEEDBACK
DO A THING
CHECK HOW
IT WENT
DO NOT BUILD ON ASSUMPTIONS
CONTEXT
• Small team
• All use IntelliJ IDEA
• ~30 repositories
• Java, Groovy, Scala
• Maven, Groovy
• Jenkins
• GitHub
WHAT YOU DO WHEN…?
• broken environment
• not meaningful exception
• struggling with technology
• struggling with project
• style-related comment during code review
EVERY TIME WHEN
FEEDBACK COMES TOO
LATE TRY TO MAKE IT
FASTER
BROKEN ANYTHING?
ADD A HELL LOT OF HEALTH CHECK BUILDS
NOT MEANINGFUL EXCEPTION?
FAIL FAST
CATCH EXCEPTION OR THROWABLE
ADD CONTEXT
AND RETHROW OR YOU’LL DIE
STRUGGLING WITH TECHNOLOGY?
ASK ON STACKOVERFLOW
(AND ANSWER BY YOURSELF)
STRUGGLING WITH PROJECT?
ADD TO KNOWLEDGE BASE
README.md wiki
STYLE ISSUES DURING CODE REVIEW?
ADD TASK TO AUTOMATE NEXT TIME
COMPILER WARNINGS
http://programmers.stackexchange.com/questions/94754/how-do-i-
convince-my-teammates-that-we-should-not-ignore-compiler-warnings
COMPILER WARNINGS
PREVENTING COMPILER WARNINGS
DEPENDENCY UPDATES
MONITORING DEPENDENCY UPDATES
MAVEN
GRADLE
HOW?
• tool that invokes the above commands in all repositories
• report for developers is created periodically
COMMIT MESSAGES
"git log origin/master..HEAD".execute().text
BUILD STATUS
JENKINS CI BUILD MONITOR PLUGIN
https://github.com/jan-molak/jenkins-build-monitor-plugin
SIREN OF SHAME
https://sirenofshame.com/
GITGUARD
Chrome extension blocking GitHub merge
button based on specified Jenkins jobs
https://chrome.google.com/webstore/detail/
gitguard/dlbacfedgdjanlkofjckclmgmijbhakl
NO RED MASTER PLEASE!
• Run all tests on branches
• Use GitHub Status API
• Merge master before running tests
ENFORCE UP-TO-DATE
• Enforce branch to be up-to-date before
merge
SHIELDS AND BUTTONS
UNIT TESTS
Fast (hundreds per second, run in parallel)
Isolated (single unit tested)
Repeatable (always the same result)
Self verifying (either pass or fail)
Timely (written early)
FIRST
BLAZINGLY FAST AND ULTIMATELY RELIABLE TESTS
mvn test gradlew test SHIFT+F10
PARALLEL TESTS CONFIGURATION
PARALLEL BUILD CONFIGURATION
GRADLE PERFORMANCE TIPS
mavenCentral() jcenter()
USE DAEMON
UPDATE TO LATEST GRADLE
gradlew wrapper –gradle-version 3.1
gradlew build --profile
USE JCENTER
PROFILE
GRADLE BUILD SCANS
COMPILE INCREMENTALLY
compileJava.options.incremental = true
CODE STYLE / STATIC ANALYSIS
• Checkstyle, PMD, FindBugs, CodeNarc
• Agree on common rules for all projects
• Shared configurations
• Gradle plugin
• Maven plugin
• Maven parent POM (tricky)
INTERNAL QUALITY PLUGIN
• Integrates all agreed tools with all
reasonable rules enabled
• Customized for project/company needs
• Zero configuration by default
• Unified console output with clickable links
gradlew checkstyleMain pmdMain findbugsMain codenarcMain
checkstyleTest pmdTest findbugsTest codenarcTest
gradlew quality
BLACKLISTS
• Use blacklists instead of whitelists to get
new rules
PMD
FindBugs
CodeNarc
EARLY STATIC ANALYSIS FEEDBACK
• CheckStyle-IDEA
• FindBugs-IDEA
• SonarLint
GATHER VIOLATIONS FROM ALL TOOLS
AND MODULES
gradlew quality --continue
mvn -fae
mvn --fail-at-end
GRADLE BASE PLUGIN
• Applies ‘java’, ‘groovy’ and ‘maven’ plugins
• Always shows full stacktraces, even if --stacktrace is forgotten
• Adds provided configuration (missing in Gradle)
• Configures repositories with dependencies
• Adds tuned compiler configuration for Java and Groovy
• Displays detailed information about all warnings (-Xlint:all option)
• Fails build on any unsuppressed warning (-Werror option)
• Adds configuration to run tests in parallel
• Enables rich test logging with summary
• (Tests run: 3, Failures: 2, Skipped: 1) and full stacktraces
• Configures wrapper task with latest Gradle
• Applies taskTree plugin
• Applies com.github.ben-manes.versions plugin
• Prints Gradle and JVM versions in the output
SANITY BUILD MATRIX
Periodically run on master series of builds using
different configurations that developers may use
• various Java and Maven versions
• various build parameters like -DskipTests
• various JVM params like locale
• compilation with fresh repository
MUTATION TESTING
• Mutations are made to the code
• If tests fail then the mutant is
• If tests pass then the mutant
• Percentage of mutants killed is indicator of
your tests quality
• Can be really
killed
lived
slow!
FAST MUTATION TESTING
scmMutationCoverage
GitHub status
Report
NON-REQUIRED CHECKS
https://help.github.com/articles/about-required-status-checks/
NONDEX
• Tool for detecting wrong assumptions
about Java APIs
• assuming specific order of HashMap iteration
• Run tests with changed implementations of
standard classes to return shuffled results
• Same happens when upgrading Java
APIS ANAYZED BY NONDEX
PLAY WITH COMMITTING .IDEA FILES
PROVISION NODES AUTOMATICALLY
GET STATUS ON PULL REQUESTS
QUICKLY
PIPELINES
https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin
gradlew build
CODE REVIEW
• Do timely
• Assign people
• Internal team review
• External review
• Address comments
OPEN PULL REQUESTS DASHBOARD
https://github.com/pulls
CONTRIBUTING FILE
create CONTRIBUTING.md in repository root
be notified
QUALITY OF FEEDBACK
RETROSPECTIVES
RETROSPECTIVES
IF IT IS NOT FUN, YOU'RE DOING IT WRONG
DIALOGUE SHEETS
https://www.softwarestrategy.co.uk/dialogue-sheets/
CONSTANT IMPROVEMENT
SUMMARY
• We want feedback to
• continuously improve
• deliver more value
• reduce risk
• learn
• Feedback has
• many types
• many sources
THERE IS NO FAILURE.
ONLY FEEDBACK.
Robert Allen

Blazing Fast Feedback Loops in the Java Universe