3. Core Contributor
&
Module Author
node-mysql node-formidable
- Joined the mailing list in June 26, 2009
- When I joined there where #24 people
- Now mailing list has close to 4000 members members
- First patch in September 2009
4.
5.
6. File uploading & processing as an infrastructure
service for web & mobile applications.
- The app we run in production
12. ~1
.5
Ye
Transloadit v1
a rs
ag
o
• Complete failure
• Node randomly crashed with:
(evcom) recv() Success
• A mess of code, hard to maintain
* http://transloadit.com/blog/2010/04/to-launch-or-not
- 0.1.18
- New version of node took out promises
- So we thought about refactoring, but ...
14. Time to rewrite
- RailsConf 09: Robert Martin, "What Killed Smalltalk Could Kill Ruby, Too
15. - We looked at asynchronous testing frameworks
- We really wanted to do TDD
- But everything we tried was hard
16. db.query('SELECT A', function() {
db.query('SELECT B', function() {
db.query('SELECT C', function() {
db.query('SELECT D', function() {
// WTF
});
});
});
});
- Who here is running node in production?
- Raise hands if you have a test suite for your node.js projects
- Raise hands if you are happy with it
- But why is it so difficult?
17. Fold news paper 7 times
Ask audience to guess the numbers of stacked sheets of papers
Ask person to guess right (128) to come up front to rip through the folded paper.
What’s this about?
- Newspaper can be thought of as a simple computer program managing 7 booleans
- Each boolean has a meaningful impact on the behavior of the Software
- This means that ripping through it at once, with a single, becomes very difficult
- The problem becomes even worse when your variables have more than 2 states
-> the euquation turns from being exponential into combinatoric one -> combinatoric
explosion
30. Transloadit
Lines of code
13.000
9.750
6.500
3.250
0
library tests
library vs test code: 1x : 2.04x
Library: 6184 LoC
Tests: 12622 LoC
Not included: Fixture data, server configuration, customer website, dependencies we
developed
31. Transloadit
Lines of code
10.000
7.500
5.000
2.500
0
integration micro
integration vs. micro tests: 1x : 4.30x
Integration tests: 2254 LoC
Micro Tests: 9695 LoC
34. node-mysql
Lines of code
1.700
1.275
850
425
0
library tests
library vs test code: 1x : 1.35x
Library: 1240 LoC (+600 LoC MySql constants)Tests:
Tests: 1673 LoC
35. node-mysql
Lines of code
1.300
975
650
325
0
integration micro
integration vs micro tests: 1x : 2.89x
Micro Tests: 1243 LoC
Integration tests: 430 LoC
37. Why do you have brakes in a car?
Because then you can drive faster.
Kevlin Henney
probably Kevlin Henney, http://olvemaudal.wordpress.com/2008/04/14/being-agile-no-
speeding-please/
38. There really are only two acceptable
models of development: "think and
analyze" or "years and years of
testing on thousands of machines".
Linus Torvalds
39. tl;dr
• Don’t use integration tests to show the
basic correctness of your software.
• Write more microtests.