Questioning the Doubts of Developers Who Donโ€™t Use ๐“๐ƒ๐ƒ

Shahab Rauf
3 min readAug 16, 2023

Hey there! Have you ever wondered why some developers arenโ€™t big fans of Test-Driven Development (๐“๐ƒ๐ƒ)? Well, they often give reasons that might not hold much water. Letโ€™s dig into this and have a friendly chat about it.

Diving straight into the code:

You know, some of us are just used to the usual way of doing things. We ๐๐ข๐ฏ๐ž ๐ฌ๐ญ๐ซ๐š๐ข๐ ๐ก๐ญ into writing code when we face a problem โ€” itโ€™s like second nature. But what if we give TDD a shot? Imagine starting our development process with TDD and sticking with it for a ๐Ÿ๐ž๐ฐ ๐ฆ๐จ๐ง๐ญ๐ก๐ฌ. I bet all those questions and uncertainties we had would get some pretty solid answers.

Experiments

This little experiment could help us see TDD and conventional programming from a whole new angle. Weโ€™d be comparing how we used to do things with how we do them after adopting TDD. Itโ€™s like watching our development practices evolve and get better right in front of our eyes.

Oh, and hereโ€™s a heads-up: before we jump into TDD, itโ€™s essential to learn the ropes. Otherwise, we might not get the whole picture. Just writing tests before diving into the actual code isnโ€™t the full TDD deal. The real deal is when you shape your code based on your tests. For instance:

๐Ÿ’ก Think about the issues the code might run into.
๐Ÿ’ก Figure out what the method should take as input and give as output.
๐Ÿ’ก Plan out how many different paths your code might take.

Red, Yellow and Green:

Once youโ€™ve got these sorted, create tests that match these expectations before you start writing the actual code. Itโ€™s like building your code piece by piece alongside your tests. And whenever a test says, โ€œHey, code, you should do this,โ€ you write your code to do exactly that. This back-and-forth process follows a cool pattern:

๐Ÿ’› Yellow: Oops, thereโ€™s no code or the code has issues, and itโ€™s giving you a compile error.
๐Ÿ’š Green: Sweet! Your code is meeting the expectations.
โค๏ธ Red: Uh-oh, the code isnโ€™t cutting it, or maybe the test is designed to challenge the code.

So, hereโ€™s the friendly nudge to give TDD a shot. If youโ€™re up for learning the ins and outs of how TDD works and how you can approach your next coding challenge with it, You can connect with me. Letโ€™s learn together!

--

--