Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example...

29
Continuous Inspection Jason Gorman @jasongorman

Transcript of Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example...

Page 1: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Continuous Inspection

Jason Gorman

@jasongorman

Page 2: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

About Me

• Training & coaching in Test-driven Development, Refactoring, OO Design Principles & Advanced Techniques for developers

• Programming since 1982

• Founder of the original Software Craftsmanship conference

• Apprentice Will Price studying Comp Sci at Uni of Bristol

• Patron of Bletchley Park Trust

• Available for Weddings and Bar Mitzvahs

Page 3: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

The 5 C’s of Continuous Delivery

Clean Code

Page 4: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Sustainable Pace

Page 5: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

What is Continuous Inspection?

Very frequent inspection of software to provide early warning of maintainability and other code quality issues

Page 6: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

3 Approaches to Code Inspections

Page 7: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Code Reviews

Page 8: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Pair Programming

Page 9: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Automated Inspections…because an extensive code review every 10-15 minutes is robot’s work

Page 10: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Example Automated Continuous Inspection Process

Change Code

[before check-in]

Run automated inspection

Check-in

Confirm changes

pass inspection on build server

Success

run inspections with updates from VCS

Fix code quality issues raised

If critical issues raised, build fails

Page 11: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

The Continuous Inspection Automation Process

RequirementAcceptance

Tests (examples)

Implement quality gate

Integration into

Continuous Delivery

cycle

Feedback

Page 12: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Quality Gates

Soft Gate

• Quality issues raised do not break the build, but may prompt further review by peers

Hard Gate

• Breaks the build• Can be overridden after

team review

Page 13: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Example Code Quality Requirement

As a developer, I need to know about any methods that have more than one dependency on features of another class so I can move them to where they belong and reduce coupling

Feature Envy

Page 14: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Example Examples

This is feature envy

This is NOT feature envy

This is NOT feature envy

Page 15: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Choose Your Weapon

• Cecil• Gendarme

Page 16: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Implementing Your Quality Gate

exploratory testing team discussion

Page 17: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Examples We Didn’t Think Of

Page 18: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

When Are We Done?

Page 19: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Integrating Your Quality Gate

Page 20: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Example FxCop Build Pipeline

If any tests fail, build fails

If new errors, build fails

If new warnings, build held for review

custom rule set

Page 21: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Continuous Inspection Patterns

Page 22: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Our House, Our Rules

Beware of reusing someone else’s ruleset

Involve all developers

Page 23: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Code Analysis Code Is Code

Apply the same care to the analysis code and Continuous Inspection “plumbing” that you apply to production code

Page 24: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Differential Inspections

Apply Continuous Inspection to new/changed code

Page 25: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Clean Code Check-in

Run code rules against changes before committing them

Page 26: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Call To Action

Report problems that developers know how to fix

Page 27: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Rising Tide

On legacy code, fail builds if quality gets worse. Raise the bar if quality improves.

Page 28: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

Adopt By Stealth

Be ready to run before making it visible

Page 29: Continuous Inspection - codemanshipcodemanship.co.uk/files/ContinuousInspection.pdf · Example Automated Continuous Inspection Process Change Code [before check-in] Run automated

www.codemanship.com