Changing the Process: Test Driven Development
Once the world was created there was marketing. Suddenly everyone needed to know buzzwords and respond to trends. One that has been around for eons, but seems to be getting some traction now is TDD or Test Driven Development.
The idea is that instead of writing code first and testing by a refresh of a browser window there is a change of methodology: Write a test first, then update the code to pass the test. If you do this the page should work in a browser and also be tested against breaking something related.
Those of us who came from the Update/Refresh school of training, like me, find it difficult. It is not just a change of working, it is a change of philosophy. I am not sure it will be easy.
Why?
I am intrigued with the idea of TDD and I would like to understand it better. I am also of the idea that if you do not try something different how can you know the benefits? Too often we look from the outside and assume that because it is different and we can see all the pitfalls from our Wonderful World View(™) that it is a bad change to make.
There are a few things that have stopped me from jumping right in, and the major one is that I can’t seem to find any information on how to shift my thinking to that of a Test Driven Developer. There are no tutorials for making the change, nothing to help me understand that little switch.
So through a series of articles I hope to detail my steps into this change of mind space.
It is time to see how (or “if) this whole different approach will suit me.
Refresh Test
I have not done any schooling for my work. It has been The School of Hard Knocks of learning and understanding. Working with other great programmers has helped develop my skills, more than I would have expected before working with them.
The process of “Refresh Testing” has been my method of development since I started. And who doesn’t start by making small changes to others code? The basic principal of learning is experimentation.
My first method was to upload the files onto the server, use a program that allows me to edit the HTML/PHP on the live server and save the file back up. In this way I would make small edits and test on the fly in a live environment.
My process now is to make small changes on a local environment, and test them by refreshing the browser. I do have enough knowledge I can go a long time writing code without “testing” it. I do use a lot of dump functions to show what I am wanting to display – in this way I switch between IDE and Browser to check that code is functioning as I expect.
Why Change What has worked for more than Five Years?
I am starting to understand that the process of programming is more than getting code to function. Especially when there is client’s money at stake and that businesses are relying on code more and more; businesses are asking me to make systems that they rely on.
There is more at stake now. It is not small websites any longer. Websites are becoming integral to companies advertising and business-process needs.
I think it is time to approach my code in a more professional way.
That Is all Nice
I don’t understand Test Driven Development. It is a foreign concept to my present mind space for developing. I have heard how important it is, how much of an improvement it makes to coding but I have no experience with it.
One of the things I am unsure about is how to get this into my present workflow. How do I think in a way that is with TDD in mind? How do I change what I do? Is there a switch I need to make in my mind.
I think I need some time to adjust. So I am going to change what I do to see if this pays off. I will make a change and allow myself to fail and I will allow myself to let this sink in. If I don’t try I can’t change the way I think and hopefully in the end it will all come together.
What do I aim to achieve
Being that this is an experiment I guess I am wanting to see the benefits to changing my approach to coding a site. I want to see if this is something I can continue to do, and I also want to see the benefits to the change.
I would like to document the change in my mind, the shift that happens by changing the process to see if there was any points where it “clicked”.
I am unsure if this will end up in me changing my practice. I would like to think that it would.
Can you help?
Are there any tips you can give me for changing my mind methodology while making these steps to a different programming style?