Skip to content

Commit 150dd4a

Browse files
committed
more review suggestions
1 parent d8b4630 commit 150dd4a

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

using/solving-exercises/tdd.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ You have solved an exercise when all the provided tests run and pass.
2020
In other words, your solution is not just an interpretation of the instructions that "looks right", your solution is a program that _satisfies the given tests_.
2121
**The tests represent the complete requirements for the exercise.**
2222

23-
## Rationale for Test-Driven Development
24-
25-
While it may seem like "putting the cart before the horse", there are several good reasons why you might want to write unit tests before writing the implementation code:
26-
27-
1. Design.
28-
It forces you to think first about the design of the **interface** to the code, instead of jumping straight to the implementation.
29-
Having a well-designed (and testable!) interface is often more important than having an efficient implementation.
30-
31-
1. Discipline.
32-
Writing tests is often seen as a chore or an afterthought; writing the tests _first_ guarantees that at the end of the day you will have written enough unit tests to cover most or all of your code's functionality (rather than possibly never getting around to it).
33-
34-
1. Less Work.
35-
If you apply a tight cycle of write one test, then write the code to implement that test, then write the next test, your code ends up growing organically.
36-
This often (though not always) leads to less wasted effort; you end up writing all the code you need, and none of the code you don't need.
37-
3823
## How does Exercism apply TDD?
3924

4025
We've done the work of writing a unit test suite for you.
@@ -69,10 +54,30 @@ We do this to encourage you to follow this workflow:
6954
Exactly how tests are "unskipped" (or selected) depends on the track.
7055
For some tracks, it might be commenting or removing an annotation.
7156
For some tracks, it might be changing an attribute from true to false.
72-
Take the time to read the track documentation: it will explain these details.
57+
Take the time to read [the documentation for your track][track-docs]: it will explain these details.
58+
59+
## Rationale for Test-Driven Development
60+
61+
While it may seem like "putting the cart before the horse", there are several good reasons why you might want to write unit tests before writing the implementation code:
62+
63+
1. Design.
64+
It forces you to think first about the design of the **interface** to the code, instead of jumping straight to the implementation.
65+
Having a well-designed (and testable!) interface is often more important than having an efficient implementation.
66+
67+
1. Discipline.
68+
Writing tests is often seen as a chore or an afterthought; writing the tests _first_ guarantees that at the end of the day you will have written enough unit tests to cover most or all of your code's functionality (rather than possibly never getting around to it).
69+
70+
1. Less Work.
71+
If you apply a tight cycle of write one test, then write the code to implement that test, then write the next test, your code ends up growing organically.
72+
This often (though not always) leads to less wasted effort; you end up writing all the code you need, and none of the code you don't need.
7373

7474
## Further reading
7575

76-
* [About Test-First Teaching](https://web.archive.org/web/20220918221108/http://testfirst.org/about) at the archived TestFirst\.org site.
77-
* [Test-driven development](https://en.wikipedia.org/wiki/Test-driven_development) at Wikipedia.
78-
* [Test Driven Development](https://exercism.org/docs/tracks/python/test-driven-development) on the Python track.
76+
* [About Test-First Teaching][test-first.org] at the archived TestFirst\.org site.
77+
* [Test-driven development][tdd-wiki] at Wikipedia.
78+
* [Test Driven Development][tdd-python] on the Python track.
79+
80+
[track-docs]: https://exercism.org/docs/tracks
81+
[test-first]: https://web.archive.org/web/20220918221108/http://testfirst.org/about
82+
[tdd-wiki]: https://en.wikipedia.org/wiki/Test-driven_development
83+
[tdd-python]: https://exercism.org/docs/tracks/python/test-driven-development

0 commit comments

Comments
 (0)