108
@JonJagger [email protected] TDD Lessons

Atlantec - tdd lessons

Embed Size (px)

Citation preview

@[email protected]

TDD Lessons

2

3

4

Bray

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

cyber-dojo.org server

22

cyber-dojo.org server

git commit

23

cyber-dojo.org server

24

cyber-dojo.org server

25

26

one or more tests failed

27

all tests passed

28

syntax error

29

30

31

32

team

33

34

35

review dashboard

36

oldest newest summaries

37

1 minute

38

39

diff

40

41

cyber-dojo.org has ~ 30,000 cyber-dojos

42

…some data… from a random

sample of 500

43

colour-to-colour diff deltas3.94

5.39

4.67

4.65

7.52

6.01

17.67

average lines of code added+deleted

13.65

bigger delta ==

greater chance of amber

44

bigger delta ==

greater chance of amber

45

11

5 6

lots of amber runs

46

colour-to-colour percentages

7.0%

7.8%

8.0%

8.1%

8.4%

11.1%

11.2%

11.3%

27.1%

lots of amber

to amber

for example

45 minute exercise

code

test?

FizzBuzz

50

waterfail

45 minute exercise

test

9 month project

waterfail

test

8 months 1 month

waterfail

test

> 8 months < 1 month

waterfail

waterfailtesttest testtest test testtest test testtest test testtest test testtest test test

testtesttesttest

debugging!

57

debugging ==

removing what you don't want

58

suppose you manage to remove

what you don't want

59

will you be left with what you do want?

60

it’s like making toast by burning bread and then scraping

the burn off!

61

specifying

debugging

DDD

TDD

specifying specifications specifications

65

tests

66

specifications

67

specific?

68

!

69

specific

70

71

suppose you’ve measured the complexity of

your code and tests

72

larger number ==

more complexity

73

2.1

the average complexity of the code is

74

by the way…

75

did you hear the one about the statistician who drowned

crossing a river only six inches deep*

76

did you hear the one about the statistician who drowned

crossing a river only six inches deep*

*average depth!

77

3.7

the average complexity of the tests is

tests

3.7 2.1

code

78

79

tests tests

11.2

tests

3.7 2.1

code

80

tests tests

11.2

tests

3.7 2.1

codeNO!

tests

2.0 2.1

code

81

<

< is the less than operator

tests

1.6 2.1

code

82

<<

<< is the much less than operator

tests

1.0 2.1

code

83

YES<<<

<<< is the much much less than operator

tests

1.0 2.1

code

84

teststeststestsYES<<<

85

example

86

example

87

88

red green

refactor

refactor

write a test for new functionality

implement the new functionality

refactor

write a test for new functionality

implement the new functionality

refactor

write a test for new functionality

implement the new functionality

improve the diagnostic

92

diagnostics that

diagnose!

refactor

write a test for new functionality

implement the new functionality

improve the diagnostic

coding

testing

94

Test Driven

Development

95

why do cars have brakes?

96

so you can drive faster

97

98

feedback

test test test test test

99

just calling it feedback doesn’t mean it has actually fed back!

100

101

sensespancreas

senses

liver &muscles

causes glycogen

causes

Hyperglycemia

pancreas

senses

glucagoncauses

sensescauses

insulin

causes

Hypoglycemia

causes

102

all change can be understood as the effort to maintain some constancy, and all constancy as maintained through change

103

Henri Louis Le Chatelier

systems tend to oppose their own

proper function

104

coding

testing

105

the battle is a means or process

of generating, maintaining, and

stabilising a system

106

evolution is always

co-evolution

107

a co-evolving system

coding

testing

@[email protected]

TDD Lessons