You always wanted to use Test Driven Development (TDD) but you don't know where to start?

Here is a thread for you about TDD in practice.

🧵 👇
1️⃣ Familiarize yourself with the three laws of TDD

These rules are the fundamentals of using TDD in practice. They constrain us to change only one thing at a time. They force us to apply babysteps!

Memorize and strictly follow these rules in order to use TDD efficiently!
2️⃣ Get started with coding Kata exercises

Katas are small programming exercises focusing on small problems.

Solving Kata exercises is a great way to deepen the fundamentals of TDD.

Pick a Kata exercise! You can find many of them here: https://codingdojo.org/kata 
3️⃣ Follow the 3-phase design (red-green-blue)

To use TDD you need to go through three design phases, repeatedly in iterations.

The three design phases:

1. RED: Write a failing test
2. GREEN: Make the failing test pass
3. BLUE: Refactor your code (including your tests as well)
4️⃣ Practice a lot

Greatness comes from practicing.

Because of the test-first characteristic, TDD requires a different mindset, therefore additional time to practice.

Make sure you have strong fundamentals by solving multiple Kata exercises!
5️⃣ Apply TDD in your project

Once you finished with Katas, it's time to put TDD in practice in your project.

Start small! Start with a failing test for a function or a class you want to implement! Follow the 3-phase design!

And always keep the three laws of TDD in mind!
✅ Why will TDD help you?

TDD will force you to:
- work in short cycles
- write automated tests
- do continuous refactoring
- continuously analyze the requirements
- write the most optimal production code

Given all of these benefits, TDD is almost a silver bullet.

Enjoy! 🙏❤️
You can follow @dmokafa.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.