high-octane dev teams: three things you can do to improve code quality

58
High Octane Dev Teams Brendan Humphreys

Upload: atlassian

Post on 15-Jan-2015

933 views

Category:

Technology


0 download

DESCRIPTION

Bugs suck. But we know they are inevitable. Finding bugs fast and dealing with them early results in higher quality code. This session explores the practical approaches to improving code quality with automated testing, continuous integration and effective code review.Atlassian Speaker: Brendan HumphreysCustomer Speaker: Rik Tamm-Daniels of AttivioKey Takeaways: * Overviews of key concepts and how to get started * Walk-throughs and configuration tips for Clover, Bamboo and Crucible * Stories from the trenches

TRANSCRIPT

Page 1: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

High OctaneDev Teams

Brendan Humphreys

Page 2: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

High Octane? Concepts / History Four rules of code review Rik Tamm-Daniels, Attivio, Inc.

Page 3: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

High Octane?

Page 4: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 5: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 6: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

Machines vs Humans

Page 7: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 8: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 9: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 10: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

Smarter Tools

• Checkstyle, Lint, PMD

• Findbugs

• Clover

Page 11: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

Continuous Feedback

Page 12: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 13: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 14: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

Feedback and Audience

Page 15: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 16: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 17: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

1998

Page 18: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 19: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 20: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
Page 21: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

2007

Page 22: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

Adoption in Atlassian

Page 23: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#1:Strive for Ego-Free Reviews

Page 24: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#1: Ego-Free Reviews

Page 25: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#1: Ego-Free Reviews

• No personal Pronouns

Page 26: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#1: Ego-Free Reviews

• No personal Pronouns

• No point scoring

Page 27: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#1: Ego-Free Reviews

• No personal Pronouns

• No point scoring

• Moderator to police

Page 28: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#2:Don’t be a Pedant

Page 29: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#2: Don’t be a Pedant

Page 30: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#2: Don’t be a Pedant

• Use tools to enforce coding style, catch common errors

Page 31: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#2: Don’t be a Pedant

• Use tools to enforce coding style, catch common errors

• Look for the forrest, not the trees

Page 32: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#3: Find Problems,

Not Solutions

Page 33: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#3: Find Problems, Not Solutions

Page 34: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#3: Find Problems, Not Solutions

• Except for trivial fixes

Page 35: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#3: Find Problems, Not Solutions

• Except for trivial fixes

• Pair program instead

Page 36: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

#4: Embrace Feedback

Page 37: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

•Especially if you are a junior developer

•You will learn to love it!

#4: Embrace Feedback

Page 38: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

Agile Quality: High-Octane Style

Rik Tamm-Daniels VP, Engineering June 1st, 2009

Page 39: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Located in Newton, MA •  Founded August 2007 •  45+ Employees •  What we do: Unified Information Access

About Attivio

Page 40: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Attivioʼs Active Intelligence Engine –  Unified Information Access Platform –  Query Unstructured and Structured Information with the

Precision of SQL and the Fuzziness of Search •  Shipped Product (OEM and Direct)

–  Maintenance Release Window at the end of each sprint –  Minor Release every 3-4 months –  Major Releases Every 12-18 months

•  Product Specs: –  100% Java –  200 MB Install –  200K Lines of Code (8000+ automated tests)

What are we building?

Page 41: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Our Team –  15 Engineers (10 very senior) – Expertise in

Enterprise Search, Data Warehousing, ETL, Linguistics, Data Mining

•  Our Process –  Agile Development

•  4 week Sprints: 3 weeks of design/code/document/test and 1 week of “Reflection”

–  Agile QA

What makes Attivio High-Octane?

Page 42: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Atlassian Tools installed on Day 1 –  Bamboo –  JIRA –  Confluence –  Fisheye –  Clover –  First Bamboo build was Green!

Attivio and Atlassian: How it all began

Page 43: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Evolutionary Process –  Sprint-by-sprint incremental process changes

•  Reliance on Tools –  Process Tools: JIRA, Confluence, Clover, Bamboo,

Fisheye –  Dev Tools: SVN, Ant, Eclipse, JMeter

•  Comprehensive Quality Strategy

Our Process

Page 44: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Maintaining “Releaseability” of code –  Ensure unit tests are built concurrently with code –  Have a “light” Release Process –  Getting green builds

•  Where does QA fit in? –  Options

•  QA “follows” development by one sprint •  Use a traditional QA waterfall model step •  Our Model: a QA sprint before each release

•  What do QA Engineers do? –  Our model: Expert team for critical testing hotspots, critical

performance tests, higher-level system testing

Agile Quality Challenges

Page 45: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  We focus on three metrics of Code Quality: –  How much code is tested and how often? –  How quickly can we detect defects? –  How quickly can we resolve defects?

•  We address these with: –  Continuous Integration –  Code Coverage –  Unified Testing

Agile + Quality

Page 46: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  We use Bamboo for Continuous Integration, Nightly Builds and System Test Builds –  Continuous Builds run on each check-in –  Nightly Builds of each Branch are scheduled and

staggered –  System Test Builds depend upon Nightly Builds

•  All Bamboo Agents run on VMWare Virtual Machines

Continuous Integration - Build Process

Page 47: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

Linuxx64VM

DefaultAgent

Linuxx64VM

Con,nuousTrunkBuild

FullNightlyBuild

Linuxx64VM

OldVersionCon,nuous

Linuxx64VM

QAInstall/SystemTests

Linuxx86VM

FullNightlyBuild

Windowsx86VM

CodeCheck

FullNightlyBuild

Windowsx64VM

FullNightlyBuild

Solarisx64VM

FullNightlyBuild

Build Agent Configuration BuildAgent

BuildType

Page 48: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

Branching Methodology

Source:Collabnet

Page 49: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  We use the Unstable Branching Strategy –  Fits with the agile methodology better that the Agile

Branching strategy •  No need to deal with too many branches •  Since our modules are already self contained we are

continually integrating all modules right in trunk •  Less merging more branching •  Ready to release code at any time without merging or

branching –  In large part because of our test coverage –  Having system, integration, smoke and performance testing as

part of our daily activity

Branching Methodology

Page 50: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  High Coverage numbers have produced low-defect releases

•  We ship with better than 80% coverage for ALL Releases

•  80% based on industry best practices •  Clover produces reports for our core and add-on

modules •  Integration Points: GUnit (grails), Selenium/

JUnit, Fluint (Flex)

Code Coverage

Page 51: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Run separately from other builds to reduce build times

•  Produces Code Coverage Artifacts –  Clover –  Cobertura –  Findbugs

•  We donʼt use Bambooʼs integrated Clover Report because it doesnʼt ft our build directory structure (each module built separately)

Code Coverage Build

Page 52: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

Code Coverage Build Artifacts

Page 53: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Unified Testing Defined: –  Common Infrastructure (Execution, Reporting)

•  Execution: Bamboo •  Reporting: Clover/Bamboo

–  Single point of defect detection and investigation •  Bamboo + JIRA and Fisheye Integration

•  Benefits –  Fewer systems for QA to learn –  Easier to maintain than traditional QA environments –  Consistent format for defect reporting and notification –  Unified view of system quality –  Easier to identify testing gaps

Unified Testing

Page 54: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  JUnit - unit and integration tests •  Custom ant-based install automation framework

and system test framework –  Generic Ant Build Model

•  Heavy use of MacroDefs and AntCalls •  Custom Ant Tasks

–  Mimics JUnit response and output format –  Can be run on build box or run on multiple build boxes

(multi-node tests, performance tests)

Unified Testing – How we do it

Page 55: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  The combination of Bamboo and Clover give us a complete view of product quality –  High-level build status –  Test Failure Reports –  Build Logs –  Build Artifacts (Clover, Findbugs)

•  JIRA and Fisheye integration allows us to quickly identify and resolve problems –  JIRA tickets –  Check-in Diffs

Unified Testing - Reporting

Page 56: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

Unified Testing Demo

Page 57: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

•  Being a High-Octane Dev Team requires focus on Quality

•  A High-Octane Agile Quality Program Needs: –  Continuous Integration for Early Defect Detection and

Resolution –  A High-level of Code Coverage –  Unified Test Execution for Simplicity –  Unified Test Reporting for Visibility –  Tooling to Tie it all Together

Conclusions

Page 58: High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality

©2007Confiden,al&Proprietary.AllRightsReserved.

Discussion Time!