Download - TDD and Getting Paid

Transcript
Page 1: TDD and Getting Paid

uf

Test DrivenDevelopment

andGetting Paid

!

Rowan MerewoodSoftware Eng. / Team Lead

Ibuildings

Page 2: TDD and Getting Paid

m

WHO AM I?

Software Engineer &Technical Team Leadat Ibuildings UK

I want to write good codeand earn a living

@rowan_m

Page 3: TDD and Getting Paid

WHO AM I?Not ?

si-am-not-a

Cconsultant

well-maybe-a-little

Page 4: TDD and Getting Paid

s

WHO AM I?Not ?

i-am-not

selling-a

book

Page 5: TDD and Getting Paid

s

WHO AM I?Not ?

i-am-not

a-slave-to

one=method

Page 6: TDD and Getting Paid

@THE GOOD

Clean code, smart devsLatest technology

Building your career

Elitist / Intimidating?

DIFFERENT SITUATIONS

Page 7: TDD and Getting Paid

gTHE BAD

Disgusting codeDevs don't careCareer dead-end

Changes break the app.Always bug-fixing

DIFFERENT SITUATIONS

Page 8: TDD and Getting Paid

cTHE UGLY

Good tests are hardWriting tests takes time

Time is money

You're not an expert(yet...)

DIFFERENT SITUATIONS

Page 9: TDD and Getting Paid

WHAT IS TDD?

1.Decide what you want to do2.Write a test to show it working3.Run the test and watch it fail4.Write just enough code to pass the test5.Re-run the test (and test suite)6.Refactor (refine/improve)7.Re-run tests8.Repeat

Page 10: TDD and Getting Paid

WHAT IS TDD?

RED

GREEN

REFACTORHsimplify

Page 11: TDD and Getting Paid

lWHY IS THIS HARD?

Do you know whatyou want

before

you code it?

Page 12: TDD and Getting Paid

lWHY IS THIS HARD?

Does your clientknow whatthey want?

Ever?

Page 13: TDD and Getting Paid

Train yourself to think like a scientist

1.Hypothesis2.Repeatable Experiment3.Conclusions ]

Page 14: TDD and Getting Paid

Train yourself to think like a scientist

1.Hypothesis2.Repeatable Experiment3.Conclusions ]

ninja

Ninja weapon

Kata( 型 or 形 , literally: "form")

A set of movements

you repeat again and again

until can do it perfectly.

Page 15: TDD and Getting Paid

!DAVE THOMAS

co-author ofThe PragmaticProgrammer

Code Katahttp://codekata.pragprog.com/

Page 16: TDD and Getting Paid

ROY OSHEROVE - TDD Katahttp://osherove.com/tdd-kata-1/

Create a simple String calculatorwith a method int Add(string numbers)

The method can take 0, 1 or 2 numbers,and will return their sum

(for an empty string it will return 0)for example “” or “1” or “1,2”

Page 17: TDD and Getting Paid

.ROY OSHEROVE - TDD Kata

demo

Page 18: TDD and Getting Paid

Now you're an expert...

Do not assume you canjust start to do thisin your project

warning

D

Page 19: TDD and Getting Paid

DDON'T BE A HERO

Introduce tests all at once...

● You will miss your deadline● Your tests will not be maintained● Your team will hate you

Page 20: TDD and Getting Paid

LDIFFERENT APPROACHES

Force testson your client

Make your clientwant the tests

Page 21: TDD and Getting Paid

LFORCING TESTS

Add a fixed percentageto your estimates.

Do not compromiseyour principles.

Page 22: TDD and Getting Paid

LSELLING TESTS

Use tests to define 'done'.

Involve the clientin creating tests.

Make the testsa deliverable.

Page 23: TDD and Getting Paid

LSELLING TESTS

Use tests to define 'done'.

Involve the clientin creating tests.

Make the testsa deliverable.

Fitnesse Frameworkhttp://fitnesse.org/

Page 24: TDD and Getting Paid

LSELLING TESTS

Use tests to define 'done'.

Involve the clientin creating tests.

Make the testsa deliverable.

Seleniumhttp://seleniumhq.org/

Fitnesse Frameworkhttp://fitnesse.org/

Page 25: TDD and Getting Paid

DDON'T BELIEVE THE HYPE

Make sure you don't over-promise.

Make sure you have theinfrastructure and skills

NO SILVER BULLETS

Page 26: TDD and Getting Paid

vINFRASTRUCTURE

1.Unit Testing2.Acceptance Testing3.Automated Deployment4.Continuous Integration5.Issue Tracking

Page 27: TDD and Getting Paid

vINFRASTRUCTURE

1.Unit Testing2.Acceptance Testing3.Automated Deployment4.Continuous Integration5.Issue Tracking

Unit/Acceptance testing

provides the technical base

Page 28: TDD and Getting Paid

vINFRASTRUCTURE

1.Unit Testing2.Acceptance Testing3.Automated Deployment4.Continuous Integration5.Issue Tracking

Unit/Acceptance testing

provides the technical baseAutomated dep

loyment

allows a quick test env.

Page 29: TDD and Getting Paid

vINFRASTRUCTURE

1.Unit Testing2.Acceptance Testing3.Automated Deployment4.Continuous Integration5.Issue Tracking

Unit/Acceptance testing

provides the technical baseAutomated dep

loyment

allows a quick test env.Continuous Inte

gration

makes progress visible

Page 30: TDD and Getting Paid

vINFRASTRUCTURE

1.Unit Testing2.Acceptance Testing3.Automated Deployment4.Continuous Integration5.Issue Tracking

Unit/Acceptance testing

provides the technical baseAutomated dep

loyment

allows a quick test env.Continuous Inte

gration

makes progress visibleIssue Tracking

allows

reporting on TDD

Page 31: TDD and Getting Paid

REPORTING

-1.Code Coverage2.Branch Coverage3.Bug Origin: - tested code - untested code4.Test/Dev Time: - per feature - per story

Page 32: TDD and Getting Paid

REPORTING

-1.Code Coverage2.Branch Coverage3.Bug Origin: - tested code - untested code4.Test/Dev Time: - per feature - per story x

Only track a metric

if it is useful

and encourages the

right behaviour!

Page 33: TDD and Getting Paid

XSKILLS & THE TEAM

Owners not heroes

Prepared to fail

Honest & Disciplined

Page 34: TDD and Getting Paid

aTDD DOES NOTCREATE GOOD

CODE

Wait...What ?

Page 35: TDD and Getting Paid

agood plan

good dev

good code

bad plan

bad dev

bad code

TDD DOES NOTCREATE GOOD

CODE

Page 36: TDD and Getting Paid

8DISASTER RECOVERY

Page 37: TDD and Getting Paid

8Untestable code?

Isolate and contain-or-

Create a testable API

DISASTER RECOVERY

Page 38: TDD and Getting Paid

8Running late?

Drop features-or-

Test the happy path-or-

Test core only

DISASTER RECOVERY

Page 39: TDD and Getting Paid

8Broken build?

Fix the test-or-

Disable the test(or delete it)

DISASTER RECOVERY

Page 40: TDD and Getting Paid

8Team doesn't care

Use incentives/games-or-

Find another job

DISASTER RECOVERY

You're worth it !

Page 41: TDD and Getting Paid

VQUESTIONS?

@rowan_m

thank-youhttp://joind.in/3218