Author: James O Coplien
Translation: Epishev Alexander
1.1 Our days
In the days of FORTRAN, when function was a function that sometimes deserved functional checks, unit testing was one of the main ingredients. Computers performed computations, while functions and procedures were computational units. In those days, the dominant design approach was to create complex external functionality from smaller pieces, which, in turn, governed even smaller ones, and so on, down to the level of well-understood primitives. Each layer supported the layer above it. Overall, you had a great chance of tracking down how the functionality at the very bottom, the so-called functions and procedureswere associated with requirements expressed in a human-accessible interface. A good designer could be expected to understand the business purpose of a particular function. Relationships in the call tree, at least in well-structured code, were just as understandable. You could mentally simulate the execution of the code during the code review.
, , , . -, , , , . . , - . , , FORTRAN. - . , , .
, β β. - - β β. - , , . , , - . - . , . , ββ, -. - , , - , , , -, .
, , , . CRC- ( , ), . . , , , , . , FORTRAN, (, , , , ). . - () , . , .
1.2
, - - , de rigueur (. " "), , -, , , . , -, , (Richard Jacobs) Sogeti (Sogeti Nederland B.V.):
β -. , , - - . -, . , , , . ( , . . .) , , ... , , , . . , ?
, , , , - . , , , : , , .
, , , , . , , , , , . β β, , , , , , . . , , , .
β , , . , . .
(, - , , , , , , , 16- ).
1.3
, 40% , , , 1- , 60% 2- 80% 3-, 100%. ! , , , divide et impera ( ). , 80% , , 80% . , , . , , . , , , , . - - GOTO. , , - (branch coverage), .
β , , , , , . .
. , , β β , . , , , , . , . .
. 100% , , , , , . - , . : , 10. ( , ) . -. , , , , 1 1012.
- - . : , , -, .
β , 24/7.
, , - . , Lean-, , Toyota, Scrum, (http://www.computer.org/portal/web/buildyourcareer/Agile Careers/-/blogs/autonomation). - , . - , - . . , , , , , , .
: , , - .. , . : β β, c J-Tag , - , . , ; , - . - .
, , , , , . . .
β . , . , ββ .
1.4 , ,
, (, , ), , , , - , , . . , , - , .
- , , , , . ; , . , , . , - . , - . , , - .
β -, . ; ; .
: , . , , , , , - . , , , . , .
β , - , ( -, ). , .
, , . .
1.5 ( )
, . , - - X 5, , , , , , X 5. , , , . ; (, , ) , , , .
. - . ( ; . .) ββ ββ , . , , . . : β ?β , β1β - , β0β - , :
11111111111111111111111111111111
, , . - 32, , , . , , , 5. , : , . . 100%, , , . . ( , .)
, ?
1011011000110101101000110101101
... . , 32. , . , , , - . , , , . , . ( , :
00000000000000000000000000000000
, , , , .)
β , , , - , , . , , , . . - , , , .
. , , . , , . , , , , , .
, . , , , , . - . , , .
β - .
- . , , , , (TDD). (, βthisβ / (non-null) , , . , , , . .)
, - - , -. , : , , , . . 1970- 1980- , (tracebility), . , NP- ( ) ( ), , , . , , : β , - ?β , : β β. , , , . : , , . , . , . , - , .
β , - , . , , -. ( , , .) .
, , , . - ; , , , - . , , . , , , API. , API , . .
β , , , β β, , . ββ -, , , , ββ, , . , , .
1.6 -
: , , , , . , 99,99% , , . , ββ, , (WCA). WCA ββ , : 100 . , , (FIT rate) 10 - (Failures In a Trillion).
, , , . , :
, ( ). , , , , , , . , , . ( : 3- - ( , ) - ( ). , , , , , .. .)
, , WCA , - - : . (side effects) , , , , . . , , .
, , , , . . , , , - . ( , : , - , , . : (Perry and Kaiser), β - β (βAdequate Testing and Objectβoriented Programmingβ), - 2 (5), 1990 ., . 13). , , . ( β β - , { , }, ; - , , , - ). (Halting Problem) , .
1.7 -
, . , ; , , ( β---β) . - . - . . , , , . , , , , , , !
, , , . -, . ( , , , , , , , . , .) , -: , (, Agile ). , XP . , Maven , -, . , , - . , : β, Maven , - - , β.
200, 2000, 10 000 , (-) , . , , 2005 , - ( ) . , - . ; . , , , , , , , , , , , , , . . , - , , - . , .
-, , , , - , , , .
1.8 !
, - . - . , - , . , -, - (TDD). , (coupling and coherence), , ( , (Janzen and Saledian), β ?β IEEE Software 25(2), / 2008 ., . 77 - 84.) , , , (coupling) . . , . ( , .)
, -, JUnit, (assertions). - , , , , , , - . , . .
- , , , , . , , . , : - β β, , , . , 5 . : β - , .β . , .
β - (assertions). . , () () ; -. - , : , , -, .
, -, , . , , , , - , . , , . , Scrum Knowsy, . , , - , . -, , . , . (Rex) , β , , β.
β ; (Lean) . , ( ) - , .
: - () -, - . , , , , , , ... ! , . , .
1.9 β , β
, - , , . - , , , , , ββ . , , , , . -, , - .
. - : , . - . , : - , - . , , .
. β β , , . , . , .
. , , (debugging). - , . - . -, ad-hoc ( ) , -, . . , , , .
1.10
Sogeti. , :
, , . . , ?
, - , , , , - . , . . 2004 , ( ) . : , , .
, , , , , , . - , . Sogeti : . . , , , , . : β , β. (fail-fast), , . , - , , ; , , , . , , JUnit .
, , , (Nancy Githinji), IT- ; Microsoft. , ( ), , . , . !
, ( ), , , , - , : β β β (fail fast) , , β¦ , - , -β. β β , , IT-. , , , β β. : β , β¦β
, : , . . , - Scrum: , , , , ( ) .
: , . , , , . . : , , . , .
jcoplien@gmail.com .
:
, , -.
-, , , , , -.
, X - X -, : - .
, .
- (assertions).
, .
: , , , , , .
, , . .
Be humble about the ability of the tests. Tests don't improve quality: developers do.