TDD??Transformation?????????????
???????????? ???????[ 2014/3/28 13:31:50 ] ????????TDD ??? ???
??????TDD????У????(Refactoring)???????????????????????????????????????????(Transformation)??????????????????????????Щ???ε?仯??????????????specific?????generic??
????Uncle Bob??????????????bowling game kata ?? Prime Factor kata???????
?????????????ε??????Uncle Bob?о??????????????????????????
({}–>nil) no code at all->code that employs nil
(nil->constant)
(constant->constant+) a simple constant to a more complex constant
(constant->scalar) replacing a constant with a variable or an argument
(statement->statements) adding more unconditional statements.
(unconditional->if) splitting the execution path
(scalar->array)
(array->container)
(statement->recursion)
(if->while)
(expression->function) replacing an expression with a function or algorithm
(variable->assignment) replacing the value of a variable.
???????????????TDD?????????(Impasse)?????????test??????????о??仯?????????????????????????———?????????????????????????????????????????????????????????????test case??????????????????????????(?????)?????????????????????????и?????test??
??????????word wrap kata????????????????У???????
assertThat(wrap(“word word”?? 6)?? is(“word
word”));
?????????Bob??????
return s.replaceAll(” “?? “
”); //(expression->function)transformation
???????????????????
???????Bob??????????????и?????????????????????????
assertThat(wrap(“longword”?? 4)?? is(“long
word”));
assertThat(wrap(“longerword”?? 6)?? is(“longer
word”));
????? (null->constant) ??(expression->function) ???
return s.substring(0?? length) + “
” + s.substring(length);
????TDD???????????????????????????????(expression->function)???Σ????????????壬???????????????????????“???”????
?????????????????case????????? (null->constant) ??(expression->function) ?????????????
????Bob??????·?????????????????????????????в??????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11