Slide 1

Slide 1 text

test-driven development why do cars have brakes?

Slide 2

Slide 2 text

At the end of this workshop... Build production quality software Experience unit testing Appreciate good design principles Gain insights Taking it further

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

“One broken window, left unrepaired for any substantial length of time, instills in the inhabitants of the building a sense of abandonment – a sense that the powers that be don’t care about the building. So another window gets broken. People start littering. Graffiti appears. Serious structural damage begins. In a relatively short space of time, the building becomes damaged beyond the owner’s desire to fix it, and the sense of abandonment becomes reality.” The Pragmatic Programmer

Slide 5

Slide 5 text

“Legacy code is code without tests.” Michael Feathers, 2002

Slide 6

Slide 6 text

code inspection only take you so far...

Slide 7

Slide 7 text

A software development technique in which automated tests are written iteratively alongside the production code TDD

Slide 8

Slide 8 text

A software development technique in which automated tests are written iteratively alongside the production code TDD

Slide 9

Slide 9 text

A software development technique in which automated tests are written iteratively alongside the production code TDD

Slide 10

Slide 10 text

A software development technique in which automated tests are written iteratively alongside the production code TDD

Slide 11

Slide 11 text

“But one should not first make the program and then prove its correctness, because then the requirement of providing the proof would only increase the poor programmer's burden. On the contrary: the programmer should let correctness proof and program grow hand in hand.” The Humble Programmer, Edsger W. Dijkstra 1972

Slide 12

Slide 12 text

No excuses Avoid “we’re too busy” Defer “let QA test the software” Deny “we don’t have bugs” Play dumb “we don’t know how”

Slide 13

Slide 13 text

Three simple rules You can’t write production code unless it makes a failing unit test pass. Rule 1

Slide 14

Slide 14 text

Three simple rules You can’t write any more of unit test that is sufficient to fail, and not compiling is failing. Rule 2

Slide 15

Slide 15 text

Three simple rules You can’t write any more production code than is sufficient to pass one failing unit test. Rule 3

Slide 16

Slide 16 text

the development lifecycle

Slide 17

Slide 17 text

half-adder circuit

Slide 18

Slide 18 text

Core entities Wire Inverter OrGate AndGate Probe

Slide 19

Slide 19 text

Courage Introduce change Refactor Evolve the design

Slide 20

Slide 20 text

Feedback Improves your design Shows how it works Tells you when done

Slide 21

Slide 21 text

TDD doesn't drive good design. TDD gives you immediate feedback about what is likely to be bad design. -Kent Beck

Slide 22

Slide 22 text

Simplicity Clean code Simple design Evolution

Slide 23

Slide 23 text

Communication Documents behavior Reveals intent Tells you when things stop working

Slide 24

Slide 24 text

Good unit tests are... Fast Isolated Repeatable Self-validating Timely

Slide 25

Slide 25 text

“Brakes allow you to travel faster because you have the power to stop.” So why do cars have brakes?

Slide 26

Slide 26 text

suggested reading