Test-Driven-Development (TDD) is a popular software development process, and you may be wondering, why? Didn’t we all finish our degrees and certifications? We are done with tests. After getting into TDD, I have grown to like it! It allows us to keep a short development cycle that reduces the amount of frustration of debugging. How so?
When you are using TDD, you begin by writing a test. Be sure to run the test to make sure that it fails. Then, you write the code to make the test you created to pass. You would then refactor the code to make the code prettier, and more concise, and repeat the process.
There are a few benefits that I have found by using this process. For one, it keeps me focused on one thing at a time. It forces you to think on the next thing that needs to be implemented in your program, and after you make your own tests pass, you know for certain that it works. You also are making sure that the code that you are adding to your project is not breaking other features and tests you created. Once you put some code in that fails tests that you previously had passing, you are made aware that you are heading in the wrong direction.
One of the mistakes that I have made when using TDD was to write a whole bunch of tests at first and try to make them pass all at the same time. When you do this, it can be very frustrating to you, and could be a sign that you are getting ahead of yourself. You really need to focus on one problem at a time. Programming is about taking big problems, and separating them into smaller problems that you are able to solve, one at a time, and I really like how using TDD helps you complete your projects in a way that is organized, structured, and helps keep your programming workflow in a effective manner, with less debugging.