What is test-driven development?
Test-driven development is a powerful coding philosophy that allows you to write code efficiently and makes its maintenance much easier. The basic idea of test-driven development is that you don’t even start to write your code unless a test is broken. Writing the tests before the code seems very boring, however when done well, it is one of the most rewarding coding experiences. Imagine the pleasure of looking at those green lights (automatic testing software usually assigns a green light to a passing test and a red light to a failing one) that tell you that your code is 100% working. When you try to refactor the code you are no longer worried about breaking it in some remote module you forgot about. When many people work on the same project it is easier to keep an eye on those young developers that sometimes try to take shortcuts in writing code. Most of all, you are sure that when all tests are passed your job is done!
Writing software in fast-changing environments
Using test-driven development is especially important when the software you are writing is likely to change very quickly, or the people that develop it are. This is because while the software documentation is very likely to be outdated (if present at all) the tests will always be there to certify the code correctness. New people coming to the project usually find a great help in looking at the tests to understand how the code works. The same people that wrote the code, especially the senior developers, sometimes forget what they did and can use the tests as reminders. A new manager handling the development team can look at the tests to quickly understand the quality of the code produced and where refactoring is necessary. Most importantly the tests, usually unlike the documentation, follow the code in the version-control system and they can be merged and updated together with the different development branches.
Lean startups and writing good software
One very good example of a fast-changing environment is given by the startup world. A good startup is lean, meaning that it changes and adapts itself to the circumstances. When a new business opportunity arises the startup often pivots to take advantage of the new possibilities. Having a test suite that certifies the code written up to a certain point provides the flexibility needed to cope with the frequent changes. Test-driven development is probably the most, if not the only, way software should be written in a lean startup.
HotTab innovating the POS-software industry
I had the pleasure to be invited to the HotTab startup in Hanoi, Vietnam, to help with the setup of their POS engine 2.0. HotTab has disrupted the POS-software industry by creating a product that is at the same time very easy to use and adapts to the every-day reality of a busy restaurant.
The vibe you get from a very dynamic startup such as HotTab, especially form its founder Sanjeev, is tantalizing. At HotTab the changes are so fast that if I am away for more than two months I can hardly recognize the place anymore (this is usually because they change the office venue). HotTab has recognized the importance of test-driven development as one of the key factors of its future success.
PS: some people may wonder how is a Restaurant POS related to Quantitative Finance, believe me, they are. Unfortunately I am not yet allowed to discuss in public how, as this is part of a top-secret project that I am working on. However, stay tuned on this channel for some exciting news on the topic.