Slide 1

Slide 1 text

JS

Slide 2

Slide 2 text

Prerequisites • node.js (e.g. `brew install node`)

Slide 3

Slide 3 text

JS libraries • Mocha (test framework) • Chai (assertions) • Sinon (test doubles)

Slide 4

Slide 4 text

Other useful JS libraries • eshint (code linter) • underscore (FP helpers) • q (async promises) • karma (test runner)

Slide 5

Slide 5 text

Code Kata Japanese: form

Slide 6

Slide 6 text

Linked List

Slide 7

Slide 7 text

Linked List var first = { value: 12 }; var second = { value: 99 }; var third = { value: 37 }; first.next = second; second.next = third;

Slide 8

Slide 8 text

Linked List var list = new LinkedList(); list.append(12); list.append(99); list.append(37); list.each(function(v) { console.log(v); }); // log: 12 99 37

Slide 9

Slide 9 text

Object Behavior • Return a value • Send a message to another object • Change internal state When receiving a message:

Slide 10

Slide 10 text

Testing Object Behavior When receiving a message: • Return a value • Send a message to another object • Change internal state

Slide 11

Slide 11 text

Linked List var list = new LinkedList(); list.append(12); list.append(99); list.append(37); list.each(function(v) { console.log(v); }); // log: 12 99 37

Slide 12

Slide 12 text

TDD • No production code which does not make a failing test pass • Stop writing test code once there is enough to fail • No more production code than will make the test pass

Slide 13

Slide 13 text

Transformations Refactor
 change form without changing behavior Transform
 change behavior while changing form as little as possible

Slide 14

Slide 14 text

Transformations • None • One • Many

Slide 15

Slide 15 text

Transformations Tranformation
 Priority Premise Transformations emerge
 in a logical sequence
 as the code evolves

Slide 16

Slide 16 text

Transformations Tranformation
 Priority Premise Transformations emerge
 in a logical sequence
 as the code evolves specific → generic