include_template( 'topper.html' ); ?> Test Driven Development include_template( 'page-start.html' ); ?>
Test-driven development (TDD) is all about writing "clean code that works." Here are some quotes (from Kent Beck) that intuitively describe TDD:
The style here is to write a few lines of code, then a test that should run, or even better, to write a test that won't run, then write the code that will make it run.
[After figuring out how to write one small piece of code ...] Now, instead of just coding on, we want to get immediate feedback and practice "code a little, test a little, code a little, test a little." [... So we immediately write a test for it.]
TDD grew out of Extreme Programming, ad evolved from the simple XP idea of "build a little, test a little" during coding. Basically, your code always has a complete set of tests that exercises its capabilities, and you write new tests as you add to your code. Practiced systematically, TDD:
Gives you confidence that your code works correctly
Helps you quickly find bugs as you write them
Focuses you on the design task
Helps you completely understand the requirements for your code
To learn more about TDD, the first place to start is the following (easy to read) classic:
Kent Beck and Erich Gamma. Test infected: Programmers love writing tests. Java Report, 3(7), July 1998.
While the Java stuff may not apply, the basic practices and emphasis of TDD are well-presented. Next, the following two articles are required reading for getting a good overall view of TDD:
Kent Beck. Aim, fire [test-first coding]. IEEE Software, 18(5): 87-89, Sept./Oct. 2001.
Dave Astels. What is test-driven development?. The Coad Letter, issue 93, 2002.
Finally, if you'd like to dig into TDD more deeply, you might find the following sources useful:
Kent Beck's book, Test-driven Development: By Example, Addison-Wesley, 2003. He posted a draft that is available on-line.
Dave Astels. Why test?. The Coad Letter, issue 95, 2002.
Dave Astels. JUnit. The Coad Letter, issue 102, 2002.
We aren't programming in Java, so we cannot use JUnit. In fact, there are many TDD frameworks available for other languages, including C++, but none applicable in this class. Further, most TDD work assumes you are developing in an OO style and will be testing classes, which isn't the case for us--we're exploring other programming paradigms. As a result, we'll use our own quick-and-dirty TDD tools:
Each of these three pages will allow you to download the corresponding tool, explain how to use it, and describe the format to use for your test cases.include_template( 'page-end.html' ); ?>