Wednesday, April 30, 2008

Philly PHPMeeup Presentation: TDD

Last night, I had the pleasure of attending a presentation about Test Driven Development (TDD), co-hosted by the The Philadelphia Area PHP Meetup Group and the Drexel Math and Computer Science Society.

The first presenter was Raymond Bokenkamp, Senior Programmer Analyst with the University of Pennsylvania School of Medicine. He gave a high level overview of TDD and the philosophy behind it which goes like this: programmers have to much to do and not enough time to do it (Stress). This leads programmers to not test as much they should or sometimes not at all. This leads to errors which leads to more stress.

As the name implies TDD lets the tests drive the development. This means that after an initial application concept, developers move immediately to listing possible tests for this applications. Tests are then programmed and run. Only then is code written to fulfill these tests. Once the test's are run, the code is re-factored appropriately and test are rerun until an error free program is produced.

Once again, the TDD work flow is as follows:
  1. List Tests
  2. Create tests
  3. Make tests work
  4. Re-factor
The key here is to write test which account for as many if not all possible use cases. This is a skill in and of itself which takes time to develop but is well worth the effort for the confidence, peace of mind, and of course low error code it produces.

The second presenter was Owen Winkler with Rock River Star, a Philadelphia-area web development shop specializing in PHP and Drupal development. Owen provided insight an into testing in general and a real world example of TDD utilizing SimpleTest, a popular PHP testing framework.

The presentations were very informative and reaffirmed my emphasis on thorough testing.

No comments: