Hello! Welcome back to my next blog post. This post is about Test Driven Development, also known as TDD. I used this article to do some research on it: Test driven development: What it is and the benefits of using it
I chose this article because it goes into further detail about what we already learnt about in class. I chose this topic because we just went over it in class recently, and we also had a homework assignment on it. At first, I was very confused on what to do in the assignment, and I had no idea what I was supposed to put in the testlog file. But by the end of the homework assignment, I kind of understood everything more, and realized that the testlog file was just meant to help me organize my test backlog, and make all of my commits with notes left behind. It took me a lot of time to come to these realizations, but once I did it helped me a lot.
This article talks about something we briefly went over in class, called the “red-green-refactor development cycle.” What this means is that first you want to write a test, which you already know is going to fail – This is the red part. Then, you want to write very simple code; Just enough to make sure the test you wrote passes – This is the green part. Finally, you want to refactor your code, and make sure not only the first test passes, but also all of the previous ones as well. Refactoring is probably the most difficult part of the process, since the other two are sort of bare minimum procedures.
I was instructed to do this in the homework assignment, but with Test Driven Development, you are supposed to only do one test at a time. I think this is smart because sometimes you can get ahead of yourself or get lost while you are trying to make multiple tests pass at the same time. Sometimes with coding I feel like you can make more mistakes trying to be fast, which ultimately slows you down. While if you take it step by step, it actually could end up being quicker than if you are rushing and not being careful.
Overall, TDD is a very interesting topic, and it was helpful that we not only went over it during class time, but also had a way to practice this with the Kata homework.
From the blog cs@worcester – Akshay's Blog by Akshay Ganesh and used with permission of the author. All other rights reserved by the author.