pair programming, tdd and other impractical things

91
Pair Programming, TDD and other impractical things by @_md

Upload: marcello-duarte

Post on 15-Jan-2015

27.241 views

Category:

Documents


1 download

DESCRIPTION

"Why should we write our tests first? Isn't that going to slow my development?" "What? Assigning a single task to 2 developers? How is that efficient? What a waste of resources!" "Look, in the perfect world your advises are great, but I have a project to finish here." In this talk Marcello explores efficiency in contrast to effectiveness. He looks into how practices, traditionally accepted as efficient, sometimes turn out to be less effective than a few "impractical" things he has come across.

TRANSCRIPT

Page 1: Pair Programming, TDD and other impractical things

Pair Programming, TDD and other

impractical things

by @_md

Page 2: Pair Programming, TDD and other impractical things

I coach teams intocollaborative software development

Page 3: Pair Programming, TDD and other impractical things

software is about people

Page 4: Pair Programming, TDD and other impractical things

software is not as much about Øs and 1s

Ø1 1 1ØØØ1ØØ1 1 1ØØØ1ØØ1 1 1ØØ1 1 1 1 1 1ØØ1 1 1Ø 1 1 1ØØØ1ØØ1 1 1ØØØ1ØØ1 1 1ØØØ1ØØ1 1 1ØØØ1ØØ1 1 1ØØØ1ØØ11 1ØØ11 1 1 1 1ØØ11 1 1 1 1 1ØØØ1ØØ11 1ØØ1Ø11 1 1ØØ11 1

Page 5: Pair Programming, TDD and other impractical things

as it is about Xs and Ys

Page 6: Pair Programming, TDD and other impractical things

it’s people who{use it

Page 7: Pair Programming, TDD and other impractical things

it’s people who{use itdevelop it

Page 8: Pair Programming, TDD and other impractical things

it’s people who{use itdevelop itorder it

Page 9: Pair Programming, TDD and other impractical things

it’s people who{use itdevelop itorder itaccept it...

Page 10: Pair Programming, TDD and other impractical things

coding is not as hard as collaborating

Page 11: Pair Programming, TDD and other impractical things

1impractical thing #1

Listen to your customer

Page 12: Pair Programming, TDD and other impractical things

Customers change their mind all the time

Customers don’t know what they want

Customers are too busy to get involved

If I listen... BANG! Scope creeps in!

Customers want everything!

I keep adding and removing must haves

impractical

Page 13: Pair Programming, TDD and other impractical things

why do I need to listen?can I please just sit and write my code?

http

://w

ww

.pho

tore

e.co

m/p

hoto

s/pe

rmal

ink/

1379

88-2

2339

026@

N00

Page 14: Pair Programming, TDD and other impractical things
Page 16: Pair Programming, TDD and other impractical things

“Nobody wants a washing machine just to have a machine, but to have clean clothes.”

– Jon Sundbo

Page 17: Pair Programming, TDD and other impractical things

When to listen?

Page 18: Pair Programming, TDD and other impractical things

Continuously

Page 19: Pair Programming, TDD and other impractical things

project mission sprint visionsprint planning sign off retrospective

Page 20: Pair Programming, TDD and other impractical things

First create a project mission

based on business goals...

not scope!

project mission sprint planningsprint vision sign off retrospective

Page 21: Pair Programming, TDD and other impractical things

http://impactmapping.org

Page 22: Pair Programming, TDD and other impractical things

WHY

WHO

HOW

WHAT

HOW

WHAT

WHAT

WHO

HOW

WHAT[Adzic 2012]

impact map

Page 23: Pair Programming, TDD and other impractical things

Include a sprint vision (example) workshop

in every iteration, prior to sprint planning

project mission sprint planningsprint vision sign off retrospective

Page 24: Pair Programming, TDD and other impractical things

Goal of sprint vision (example) workshop

To define sprint vision and acceptance criteria

Page 25: Pair Programming, TDD and other impractical things

As an <actor>I can <behaviour>So that <value>

Given <pre-condition>When <act>Then <expectation>

produ

ct ba

cklog

Page 26: Pair Programming, TDD and other impractical things

What if the customer isn’t available?

Page 27: Pair Programming, TDD and other impractical things

proxy

Page 28: Pair Programming, TDD and other impractical things

Write the form for the comment area

1/2 d

produ

ct ba

cklog

sprint

backl

og

sprint planningsprint vision sign off retrospectiveproject mission

Page 29: Pair Programming, TDD and other impractical things

sprint planningsprint vision sign off retrospectiveproject mission

Page 30: Pair Programming, TDD and other impractical things

sprint planningsprint vision sign off retrospectiveproject mission

Page 31: Pair Programming, TDD and other impractical things

2impractical thing #2

Test Driven Development

Page 32: Pair Programming, TDD and other impractical things

It takes time to learn TDD

How can I test something I haven’t done yet?

The team is not confident they can do it

It’s legacy. The code is untestable

Customer is not paying for tests

My manager doesn’t give me time to test

impractical

Page 33: Pair Programming, TDD and other impractical things

requirements

designanalysis

codetest

deploy

Page 34: Pair Programming, TDD and other impractical things

requirements

designanalysis

codetest

deploy

9 months

Page 35: Pair Programming, TDD and other impractical things
Page 36: Pair Programming, TDD and other impractical things

most of the cost in software comes from

feedback delay

Page 37: Pair Programming, TDD and other impractical things

user stories

testconversation

codedesign

deploy increment

Page 38: Pair Programming, TDD and other impractical things

user stories

testconversation

codedesign

20 min

deploy increment

Page 39: Pair Programming, TDD and other impractical things

test

coderefactor

Page 40: Pair Programming, TDD and other impractical things

test

Arrange

Act

Assert

Page 41: Pair Programming, TDD and other impractical things

test

Arrange

Act

Assert

Write the code you wish you had

Page 42: Pair Programming, TDD and other impractical things

code

Change the message or get it green, not right

Page 43: Pair Programming, TDD and other impractical things

refactor

Now get it right. Without modifying behaviour.

Page 44: Pair Programming, TDD and other impractical things

refactor

1. All tests run and pass2. Remove duplication3. Remove opacity4. Remove complexity

Page 45: Pair Programming, TDD and other impractical things

results in code

1. Testable2. Modular3. Expressive4. Simple

Page 46: Pair Programming, TDD and other impractical things

lack of tests breaks inner quality

1. Viscosity2. Immobility, Rigidity, Fragility3. Unreadable4. Complex

Page 47: Pair Programming, TDD and other impractical things

THE CODE IS TERRIBLE!!WE NEED ONE SPRINT TO REFACTOR

Page 48: Pair Programming, TDD and other impractical things

Refactoring: changing the structurenot the external behaviour

– Fowler, 99

Page 49: Pair Programming, TDD and other impractical things

There is no refactoring without testsThere is no testing without refactoring

Page 50: Pair Programming, TDD and other impractical things

“Code is a representation of design” – Jack W. Reeves

Page 51: Pair Programming, TDD and other impractical things

refactoring === design

Page 52: Pair Programming, TDD and other impractical things

Agile without TDD*is like cinema without popcorn

*or similar practice

Page 53: Pair Programming, TDD and other impractical things

3impractical thing #3

Focus on Quality over Schedule

Page 54: Pair Programming, TDD and other impractical things

The budget doesn’t cover quality

There is no time for quality

It’s a very simple project

We’ve done it thousand times

Quality is vague, deadlines are real!

Do the needful now. We’ll come back to it later

impractical

Page 55: Pair Programming, TDD and other impractical things

Quality is like onions

Outer Quality

Inner Quality

http

://w

ww

.flic

kr.c

om/p

hoto

s/m

onte

regi

na/4

1033

1783

2/

Page 56: Pair Programming, TDD and other impractical things

Outer Quality

Works as expected

Looks like expected Focused on goals

Built efficiently

Page 57: Pair Programming, TDD and other impractical things

Inner Quality

Modular

Simple

Testable

Expressive

Page 58: Pair Programming, TDD and other impractical things

Lack of Outer Quality Causes...

Page 59: Pair Programming, TDD and other impractical things

Rework

Bugs

Missing deadlines

Going over budget

Relationships deteriorate

Low Morale

Unusable systems

Project abortion http://www.flickr.com/photos/hayeycart/5900737110/

Page 60: Pair Programming, TDD and other impractical things

But what causes poor Outer Quality?

Page 61: Pair Programming, TDD and other impractical things

Lack of automated acceptance tests

Lack of customer involvement

Team not focused on Project Mission

Lack of Inner Quality

Page 62: Pair Programming, TDD and other impractical things

Lack of automated acceptance tests

Lack of customer involvement

Team not focused on Project Mission

Lack of Inner Quality

Page 63: Pair Programming, TDD and other impractical things

Focus on schedule

Haste

Fear

Re-work

Low morale

Page 64: Pair Programming, TDD and other impractical things

Focus on quality

Do the right thing

Align with goals

Achieve

Pride

Page 65: Pair Programming, TDD and other impractical things

How do you ensure Outer Quality?

Page 66: Pair Programming, TDD and other impractical things

Example workshops

Automate acceptance tests

Have a sprint vision statement

Sign off during Sprint

Page 67: Pair Programming, TDD and other impractical things

How do you ensure Inner Quality?

Page 68: Pair Programming, TDD and other impractical things

TDD

CI (tests, static analysis) from day one

Pair Programming or at least Peer Review

Page 69: Pair Programming, TDD and other impractical things

4impractical thing #4

Pair Programming

Page 70: Pair Programming, TDD and other impractical things

Why isn’t everyone else doing it?

2 resources 1 task? do the math!

They will just chat and not get anything done

I do all the work the other guy just looks

How do you track the time per task?

Geeks don’t want to talk to other people

impractical

Page 71: Pair Programming, TDD and other impractical things

2 developers

sharing a screen

working on the same task

Page 72: Pair Programming, TDD and other impractical things

What is Pair Programming about?

Page 73: Pair Programming, TDD and other impractical things
Page 74: Pair Programming, TDD and other impractical things

Jon Jagger’s Principles of Improvement

Company

Addiction

Feedback

Visibility

Success

Provocation

Page 75: Pair Programming, TDD and other impractical things

Pair programming is about improving faster

Page 76: Pair Programming, TDD and other impractical things

One of the few proven agile practices

“Strengthening the casefor pair programming”

bit.ly/pair-case

Page 77: Pair Programming, TDD and other impractical things

Should pairs be kept together?

Page 78: Pair Programming, TDD and other impractical things

Who to pair with who?

Page 79: Pair Programming, TDD and other impractical things

Important stuff

✓ Focus on the code

✓ Use the test list✓ Don’t “I-show-you” your pair

✓ Time box decisions

Page 80: Pair Programming, TDD and other impractical things

How do I learn this?

Page 81: Pair Programming, TDD and other impractical things

5impractical thing #5

Code Katas

Page 82: Pair Programming, TDD and other impractical things

What? Write code and delete it? What?

Who’s paying for that?

I am already working 9 to 5

Solving a problem that has already been solved?

I am committed to a sprint

I have a release, can’t join you today

impractical

Page 83: Pair Programming, TDD and other impractical things

“Adults don’t think their way into a new way of acting.They act their way into a new way of thinking” –

Richard Pascale

Page 84: Pair Programming, TDD and other impractical things

✓ 1 hour every week

✓ developers go to a meeting room

✓ do TDD in pairs

✓ 20 mins each round

✓ at the end of each round:

✓ delete the code and swap pairs

Page 85: Pair Programming, TDD and other impractical things

http :// lmgtfy.com/?q=code+kata

Page 86: Pair Programming, TDD and other impractical things

“We have a great tool in this language. We can kill it by making a mess. We can kill it by being

arrogant. We can kill it by ignoring the enterprise.”

Page 87: Pair Programming, TDD and other impractical things
Page 89: Pair Programming, TDD and other impractical things

I work here

I contribute here

I tweet here @_md

Marcello Duarte

Page 90: Pair Programming, TDD and other impractical things

Thank you !

Page 91: Pair Programming, TDD and other impractical things

Questions or Comments?

looking for a new challenge? inviqa.com/careers

joind.in/8110 slidesha.re/13sYRzS