Andrew Dacenko <asd@fb.com>
Front End Engineer @Facebook
August 6, 2018
TEST DRIVEN DEVELOPMENT
GOAL
![](https://s3.amazonaws.com/media-p.slid.es/uploads/66414/images/4437281/the-car.png)
ARCHITECTURE
![](http://in2gpu.com/wp-content/uploads/2015/02/engine-wallpaper-4.jpg)
DEVELOPMENT
![](http://www.rodmatthews.com.au/_assets/images/blog/Positional%20Images/Complexity%20Small%20Version.jpg)
TDD STEPS
Navigation List
Test First
Assert First
Fail First
NAVIGATION
-
Create view
-
Validate form inputs
-
Show errors
-
Redirect on submit
Write NAVIGATION MAP for your current/next task at project
TEST FIRST
import add from './add';
it('should add numbers', () => {
});
ASSERT FIRST
import add from './add';
it('should add numbers correctly', () => {
expect(add(0, 2)).toBe(2);
});
FAIL FIRST
![](https://s3.amazonaws.com/media-p.slid.es/uploads/66414/images/5157306/Screenshot_2018-08-06_02.45.37.png)
PROCESS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/andreykucherenko/images/907293/tdd.jpg)
PROS
-
Requirements are met
-
Correctness
-
Improved code
-
Code as documentation
-
Safe refactoring
-
Coverage
- No dead code
TDD ARTIFACTS
Pomodoro
Pair Programming
Continuous Integration
POMODORO
![](http://lifeiscrafted.savvysassyshe.com/wp-content/uploads/2013/04/pomodorproduct-timer-steps.jpg)
PAIR PROGRAMMING
![](https://s3.amazonaws.com/insights-images-prod/1020ways20pair20programming203_7a4eac1abfb725cdba521e485086d3ea.png)
CI
![](https://s3.amazonaws.com/media-p.slid.es/uploads/66414/images/5157313/Screenshot_2018-08-06_02.55.07.png)
FIX IT LATER
![](https://inkflesh.files.wordpress.com/2011/03/hurricane_ike_broken_windows_highrise2.jpg)
At each step in time, the following transitions occur:
- Any live cell with < 2 live neighbours dies, as if caused by under-population.
- Any live cell with 2 or 3 live neighbours lives on to the next generation.
- Any live cell with > 3 live neighbours dies, as if by over-population.
- Any dead cell with exactly 3 live neighbours becomes a live cell, as if by reproduction.
A.K.A. B3/S23
CONWAY`S GAME OF LIFE
Novice
- Use ping-pong technique
- Code without conditional statements
Advanced
- Use immutable approach
- Implement infinite board
- Implement hexadecimal board
Expert
- Implement healing board
- Implement async board
STAGES
Q&A Time
TDD Workshop
By Andrew Dacenko
TDD Workshop
TDD Workshop for Coders of Colour Aug 6th, 2018
- 653