Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition
by Craig Larman
20.9. Test-First Programming
An excellent practice promoted by the Extreme Programming (XP) method [Beck00], and applicable to the UP (as most XP practices are), is test-first programming. In this practice, unit testing code is written before the code to be tested, and the developer writes unit testing code for all production code. The basic rhythm is to write a little test code, then write a little production code, make it pass the test, then write some more test code, and so forth.
Advantages include:
The unit tests actually get written— Human (or at least programmer) nature is such that avoidance of writing unit tests is very common, if left as an afterthought.
Programmer satisfaction— If a developer writes the production code, informally ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access