Clean All the Things: Encouraging Clean Code in Big Teams

Preview:

Citation preview

ZILLOW | TRULIA | STREETEASY | HOTPADS

CLEAN ALL THE THINGS!ENCOURAGING CLEAN CODE IN BIG TEAMS

Dave Rochwerger, Engineering Director, Agent Platform @catchdave

ZILLOW | TRULIA | STREETEASY | HOTPADS

ZILLOW | TRULIA | STREETEASY | HOTPADS

Zillow Group

• Culture is paramount

• Many teams, many offices (SF office > 200 engineers)

• Up to 100 engineers contribute to a repository

• Many products, release cycles & techs

Clean Code

ZILLOW | TRULIA | STREETEASY | HOTPADS

Clean Code

• Low defects

• Maintainable

• Testable

Clean code in large companies?

ZILLOW | TRULIA | STREETEASY | HOTPADS

2014: The Bad

• Too many bugs

• Highly coupled, low communication teams

• Preventable mistakes (code quality & releasing)

• Inconsistent testing knowledge & usage

ZILLOW | TRULIA | STREETEASY | HOTPADS

2014: The Good

• Company-wide training

• Code quality guidelines

• IDE plugins

• Git hooks

• Post-merge CI jobs

ZILLOW | TRULIA | STREETEASY | HOTPADS

ZILLOW | TRULIA | STREETEASY | HOTPADS

Mr. CleanEncouraging high code quality

ZILLOW | TRULIA | STREETEASY | HOTPADS

Mr. Clean Goals1. Push defect detection as early as possible

2. Make it difficult to contribute bad code

3. Make it easy to contribute good code

• Automate away easy things

• Code review focus should be subjective

Design' Coding' QA' Post/release'

Effort'

ZILLOW | TRULIA | STREETEASY | HOTPADS

“Culture eats strategy for breakfast”

ZILLOW | TRULIA | STREETEASY | HOTPADS

Blocks Merging

ZILLOW | TRULIA | STREETEASY | HOTPADS

Stash Integration

ZILLOW | TRULIA | STREETEASY | HOTPADS

Jenkins Integration

ZILLOW | TRULIA | STREETEASY | HOTPADS

Approach• Lots of testing

• Kept goals in sight

• Iterate, iterate, iterate

• Garner constant feedback

• Stealth deployment (nothing like testing in prod)

• Communicate, communicate, communicate

ZILLOW | TRULIA | STREETEASY | HOTPADS

Results (so far)

• 15,000 PRs examined since May

• Bugs were found on day 1

• Test suites 100% usable

• Many “saved my life” anecdotes

ZILLOW | TRULIA | STREETEASY | HOTPADS

Results (so far)

Bugs per week down 30%

0"

2"

4"

6"

8"

10"

12"

14"

16"

18"

20"

1" 2" 3" 4" 5" 6" 7" 8" 9" 10" 11" 12" 13" 14" 15" 16" 17" 18" 19" 20" 21" 22" 23" 24" 25" 26" 27" 28" 29" 30" 31" 32" 33" 34" 35" 36" 37" 38" 39" 40" 41" 42" 43" 44"

Bugs%fo

und%

Week%Number,%2015%

Team%A%Bugs%

Team"A" Expon."(Team"A)"

Mr."Clean""

The Future

ZILLOW | TRULIA | STREETEASY | HOTPADS

Insights Reporting

ZILLOW | TRULIA | STREETEASY | HOTPADS

Take-aways

• Clean code is important

• Clean code is harder in large teams

• Fostering the right culture is key

• Spread the word about your great work!

ZILLOW | TRULIA | STREETEASY | HOTPADS

Questions?

Dave Rochwerger @catchdave

ZILLOW | TRULIA | STREETEASY | HOTPADS

Recommended