Yet another post in an occasional series detailing the way that 3hv works. Read more here or subscribe to be notified when a new article is posted, or find out why hiring 3hv will benefit your business.

This is the most important of the lot. Where the work gets done. Where I earn my money.

I believe in Test-Driven Development. This is a method of software development where, before you write any code, you write a test that proves the function.

So, the specification may read “the user goes to the product page, clicks the edit button and changes the product name. Upon clicking ’save’ the product listing is updated with the new name“. Using TDD I would write a test that simulates calling the product page, clicking the edit button (with its implied suggestion that this brings up a new page that lets you edit the product), change the product name, click ’save’ and then check that the product listing is updated.

Because the test is written first, I need to write some code to make it pass. Until the test passes I know that I haven’t met the specification. As soon as it passes I know that I am done. No overblown, complex code (complexity takes longer to write, is harder to debug and easier to break). I just write the bare minimum to make the test pass. As the test represents the specification, I know that I have done enough to meet the client’s expectations.

But TDD has extra benefits. I can go back and improve the code (maybe I discovered a more efficient way of performing an operation and need to change the existing code to use it). Making such changes often fills developers with dread as it could break stuff (”if it ain’t broke don’t fix it“) - but as I have a suite of tests I can make changes, safe in the knowledge that everything still works and meets the specification (in the trade, this is known as refactoring). Which means that the code stays beautiful - easy to read, easy to maintain, easy to improve. So you, the customer, benefits.

Want to know the secret of how to do it? Here it is - Implementing a Task

3hv is a small software company in Leeds, England. If you’re of a technical bent then take a look at the geek blog - made of stone. Otherwise just subscribe to be notified when new stuff is posted here.

Posted on December 21st, 2007 | filed under Business, Processes, Transparency | Trackback |

Leave a Reply

You must be logged in to post a comment.