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.
Here is a thread for you about TDD in practice.
Familiarize yourself with the three laws of TDDThese 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!
Get started with coding Kata exercisesKatas 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
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)
Practice a lotGreatness 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!
Apply TDD in your projectOnce 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!

Read on Twitter