Thoughts on Test Driven Development

John Zhang
2 min readDec 1, 2020

--

Since starting to code a earlier this year, test driven development has been a constant method I’ve used. Compared to traditional styles of development, I find test driven development is particularly useful in maintainability. Being able to change pieces of code without risk of adversely affecting other parts of the app has been incredibly helpful.

The process has been quite simple: First you conceive and write a test. Could be a function or a change to an existing function. Next you test the new additions with the rest of the code to check if it works. If the test passes, go back to the first step and try to write a test that would cause the code to fail. Upon finding a test that fails, it is time to figure out how to modify your code to pass the failed test. The idea behind this is to stress test your code against all possibilities that you think you would come across. The solutions that you conceive may be rough or unrefined but that is fine as this is an important step in understanding why the test fails. Finally upon all the tests passing as intended is the point of cleaning up the code, to refine your solutions.

Using this method is incredibly time consuming but very effective in refining apps to be clean, usable and readable. The tediousness of this method also has the side function of causing the coder to simplifying the code as much as possible. Of course there is the down side of one person may not be able to visualize all scenarios an app may come across but that is where multiple eyes and minds can help.

While not but favorite development process, the results are undeniable. Thanks for reading.

--

--