There are a lot of articles about TDD, and I noticed that they all concern mainly the technical component of this approach, and practically do not describe in any way the mental principles underlying TDD.
Therefore, I did not want to write another article describing the Red-Green-Refactor technique. I wanted to look a little deeper at TDD and describe how and why TDD affects human behavior.
The article will focus on some abstractions that are applicable on different layers of the worldview and, regardless of the context, help to achieve a good result. The versatility of these abstractions, and the fact that they even apply to the coding process, made me an ardent advocate of both the TDD approach and these abstractions.
My first steps in TDD
web- 12 . 10 php CMS- Joomla Bitrix. , . CMS 2 javascript (React).
, , , , , , . , -, , TDD , , , 2013 . , , , , .
, , , , . , TDD, Professional Scrum Developer scrum.org.
, (, ) , , , CMS.
- βTest Driven Development: By Exampleβ Kent Beck. , TDD, , - , . , , βTDDβββ , β. , . β¦
50- , . , TDD,βββ , β¦ , , . , , βββ , 2β5β15 . , βββExample of TDD by H. Koehnemann, , acceptance test .
. , TDD , . , , TDD , TDD () .
:
(todo list)
-, TDD. /. . , , , .
, . . , - GettingThingsDone. GTD , , , , .
/ , ( ) , , , (β β, β β), . .
? , . .
. , .
Test-First Thinking
Test-first βββ βββ . , , β ?β. test-first , . β β, , Agile , YAGNI KISS . , β , ?β.
βββ , . , , . , , , ,βββ, ? , . , , , . , . , ( ).
, M S.M.A.R.T. .
, βββTest-First Thinking. . β - ?β, β , ?β, β , ?β. , , . , , . , .
, ?
?
. , .
? GTD, , , , . , , , βββ.
, TDD: , β¦ β¦ .
, - . , , .
, , - , βββ . , , :
1. β β , . , , , ;
2. .
:
describe(β factorialβ, () => {
it(β 0 β, () => {
β¦
})
})
:
describe(βfactorialβ, () => {
it(β 0β, () => {
β¦
})
})
GTD. . ( 3).
( ) . . , THIS IS WHY YOU SHOULDNβT INTERRUPT A PROGRAMMER The Cost of Interruption for Software Developers.
, , , βββ ( ) (, , email-).
, , . . () , , , β β ( ) .
βββ (, , ). , , .
. ( ?βββ. ) .
, TDD, βββ .
coverage
, , β¦ . . , . . , .
, , , . .
( ()βββ []). . , TDD, , , TDD , .
, TDD , . , , . , , TDD. , TDD , . PS- ( 2020) 2020.
TDD
, .
TDD , TDD :
. , , . , , , TDD .
, , -. , /, . , , , , / , , , .
TDD. TDD. β-β. , , TDD ( , , ).
. . .
- , . -.
P.S. ()
In the comments I noticed a classic holivar on the technical / practical pros / cons of TDD. My favorite holivar on this topic is here - https://habr.com/ru/company/jugru/blog/313514/ . Highly recommend.
But the article was about mental tricks to share a new perspective on this approach. I wanted to talk about them in the comments. Thanks.