To strive for perfection but fall two steps short, is all but human. I remember with mixed emotions the German classes back at school. Quite often we had to do essays on this or that topic. Quite often I got good marks for essay’s idea and its composition just to loose a couple of points for (surely involuntary) grammatical inadequacies.
Writing software is pretty similar: The most elegant lines of code will be undone by mundane errors.
Error recognized, error fixed, or so they say. Yet research shows that on average for every six errors fixed, one new error is introduced. Kind of never catch up game. Similar to the anecdote of Achilles, who is not able to catch up with the turtle.
A scalable website is a complex beast. Even in it’s simplest form it is a web of thousands of lines of code, several servers and services.
Humans perform mostly well in conditions of relative uncertainty. Computers not. Whereas we are able to adapt to situations, computers fail abysmally at tasks that are not clearly specified and where there is no error free code to execute. An unrecognized set of characters in a get request and the receiving web service goes havoc. A minor glitch in a sub-routine and the transaction fails.
Thus the importance of testing.

Picture by jackhynes
Testing comes in a number of flavors. Every developer agrees that code should be tested. However, testing on an individual code level is not enough. Especially hard it gets if you have to take over legacy code with little test coverage. My colleague Patrice suggests two simple rules:
- No bugfix without a test
- Develop new features using the test-driven methodology
Here at Nektoon our goal is to cover as much code with tests as possible and sensible. We don't reach 100% coverage but accept one or two percent less. Going all the way to 100% will drive you crazy, as there is a lot of code, which hasn't been written with testability in mind. Testing such code while possible would be a lot more work.
A certain level of error is an acceptable outcome for a system like ours. A simple solution is some redundancy to be built in.
We consider testing integral to our work. Before automatically building the application (also referred to as continuous integration – see previous post on automation) any piece of code must be thoroughly tested.
The equation is simple: What will the additional time investment in testing yield in terms of benefits? The answer: A lot! Simpler code, more reliability, less onerous bug fixes, and less disappointed users because our service was down.
We believe in testing. Over on his personal blog, Patrice commenced a series specifically dedicated to testing. Over the next few weeks he will write about selection and setup of a testing framework, unit and functional testing, Javascript testing, continuous integration, test-driven development, testability and measuring coverage.
Next in the series how to build a scalable startup: Conclusion.