Sunday, July 15, 2007

My Test Driven Environment

Recently I've began using test driven development in some of my projects.
The basic idea of TDD is writing tests first before actual coding. This ensures staying close to a working codeline, fun in development and loss of fear to touch code for refactoring and other purposes.

Working in very small steps ensures that the code remains of high quality.

The diagram demonstrates the process of decision making during test driven development.

For more info on TDD see the following two links:
Agiledata
Test Driven

TDD is used in Extreme Programming (XP), which is an agile software engineering methodology created by Kent Beck.


Recently I have read a book from Kent Beck: Extreme Programming Explained.

To support the concept of separating feature-adding and refactoring tasks Kent Beck recommends "wearing" hats. The hat of feature-adding/bug-fixing and the hat of refactoring. This ensures that refactoring is done separately from other development tasks.

I apply this concept in an extended way.
Each step in TDD is represented by a "hat". The hats are small pieces of paper with the task written on them.
On my desk I have a small dolphin. He is the one wearing a hat.
Each hat is given a number, and I have one or more options to go further.
When the dolphin wears a specific hat I deal only with tasks which are closely related to that hat.




For example after refactoring (5) I can go to 4, which is running tests.
Let's say I would jump from refactoring to a bug-fix. Then my hat says "No! Run tests first!".

Here we can see my dolphin wearing the 'refactoring' hat.

These hats help me to keep the discipline of TDD methodology, and they add much fun to the work.

No comments: