Category: Test-Driven Development
-
TDD in the real world
This section discusses the most common questions and discussions around TDD. Some developers love TDD and defend its use fiercely; others recommend not using it. As always, software engineering practices are not silver bullets. The reflections I share in this section are personal and not based on scientific evidence. The best way to see if…
-
Reflecting on our first TDD experience
Abstractly, the cycle we repeated in the previous section’s development process was as follows: This TDD process is also called the red-green-refactor cycle. Figure 8.1 shows a popular way to represent the TDD cycle. Figure 8.1 TDD, also known as the red-green-refactor cycle TDD practitioners say this approach can be very advantageous for the development process. Here…
-
Our first TDD session
For this example, we will create a program that converts Roman numerals to integers. Roman numerals represent numbers with seven symbols: To represent all possible numbers, the Romans combined the symbols, following these two rules: For instance, the number XV represents 15 (10 + 5), and the number XXIV represents 24 (10 + 10 –…
-
Introduction
Software developers are pretty used to the traditional development process. First, they implement. Then, and only then, they test. But why not do it the other way around? In other words, why not write a test first and then implement the production code? We discuss this well-known approach: test-driven development (TDD). In a nutshell, TDD challenges our traditional…