Starting your TDD journey

The old story always comes around when talking about tests: it takes too long to do them and we loose a lot of time. Well, everything is hard to do if you are learning it. You need to practice and practice and practice to become proficient in any new skill.

Let’s imagine you want to start playing tennis.  What can you do to achieve your goal? You register in the tennis club near you and you start training. You go every week days. 4 days you practice with the machine that throws balls at you, and the other day you practice with a coach that shows you the technical skills you must develop to become a good tennis player.

So why not do the same when talking about developing a new skill as a developer? Why not start your day with a kata to enhance your TDD skills. Nowadays there is a lot of sites that provide small katas in several languages. There are a lot of then that have the solution so you can see how others have approached the same problem.

Going back to tennis, do you think that after a week you would be able to play against Rafa Nadal or Andy Murray?  And after 6 months? Probably only after 5 or 6 years you would be able to be at there level.  So why think that after a week of trying TDD you should be super efficient and be the best of it? Do you think that Uncle Bob or Sandro Mancuso were proficients in TDD after a week? After 6 months? If you want to be good at something you must practice. What better place that at work were you can beneficiate from having good tests that will improve your code and reduce your bugs?

So now  you can start your journey into TDD knowing what you should expect from yourself: hard work! If you google “kata” you will find a million links to kata sites, Github repositories, there’s a lot of examples in the net, so just put your hands on it.

There’s really no excuse to not do TDD. Well then you’ve got the skeptical one’s that don’t believe  that “wasting your time doing tests” will improve in any way your code or your way of thinking about your code.

If you really want to embrace TDD, and you feel you have a lot of resistance from your colleagues and manger, the best is look for a job in a company that looks at TDD as a fundamental tool for their developers to be great at their job. They are around. Not so many as you expected but the number is growing.

Leave a Reply