Testing, Developing, Developing

Test Driven Development — it’s double development!

Development is a process that creates growth, progress or positive change.

I’m all red all day! This is my second day on the Andela Self Learning Clinic. Today, we were getting started with programming logic and TDD. It’s been an awesome learning experience. I wasn’t sure about what to do when the day began but at least I got some ground to stand on by evening. Before today, I’ve been living wondering why one should write tests before writing actual code. Actually, for the time I’ve been coding, I wrote tests after implementing the functionality: that is if I wrote them. I’m yet to confirm, but I feel that TDD has the potential to speed up your development process.

So, what I’ve I done differently? I’ve gone all red!

When writing my first test, I was just imagining the hustle I go through when trying to find out what a simple function actually does what I want it to do. Without tests, if I wanted to see if my program behaves well in ten different scenarios and I do that ten times in the entire development iteration, it would mean running the program a hundred times. But, if I had automated tests, I would only run the tests ten times! I find that amazing.

On that realization, I met with the urgency of writing tests. Now, why write tests before the actual program implementation? From various points of insights and instruction, I learnt that this practice helps greatly in understanding of the project requirements. Consequently, this means that the developer (me) has a clear goal and gets to know exactly what is ready and what is not.

Faced with the challenge of meeting deadlines, I felt the overhead of adapting TDD. However, whenever the temptation of implementing some code before functionality came around, I just heard the voice of the bleating goat. The bleating goat is a reminder to write tests first! Ultimately, I’ve managed to write tests for part of my app but I have zero functionality. Trust me, the feeling is fulfilling, especially the fact that you got a clear idea on what to do next. I know that I’ll make it to implement the features more gracefully and confidently than before.

End of Day 2! TIA!