Test-Driven Development (TDD) can be a scary concept to hear at first.
How are you supposed to write code that test your code... even before it even exists?
Well, yeah. It can be done and it's a really awesome way of writing code.
Some of the benefits of TDD are:
- The code coverage will (most of the time) be pretty high.
- There won't be more tests "to write later".
- You can refactor your code with more confidence since there should be a bunch of tests that will make sure you don't break anything.
- The code will be testable from the beginning because you would not be able to do it without it from the get go.
- Probably a few more that I can't remember right now 🤓
Alright, enough chitchat. I've decided to do it while solving a well-known interview question/exercise named FizzBuzz on this video: