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.

Tuesday, April 22, 2008

Working with DTS

I have been doing quite a bit of work with DTS, short for Data Transformation Services, a feature of M$ SQL, which facilitates getting data in and out of the db, among other things. One of the best features of DTS is the ability to set packages to run at regularly scheduled intervals. For instance, every night a csv file gets dropped in a networked folder. My package then ingests that file into our db for later use.

The easiest way to get started with DTS is to use the Data Transformation Services Import/Export Wizard and then save the package for later modification and use. This wizard is accessible by right clicking on a table and selecting from All Tasks Import or Export Data. I have found csv files to be much easier to work with than excel files.

A very useful DTS package i put together runs a query to pull the accounts that were added last the day before, dumps the data into a csv, emails the csv as an attachment and finally runs a query to update the records to show that they have been emailed.