TDD and Refactoring
Table of Contents
Over the days I have been reading on Test Driven Development(TDD) and it seems really interesting methodology to go with as per development is concerned.
Basic of TDD is that the development process relies on 'tests', that are written prior to code.
Sounds astonishing!!!!
It might to someone into the normal development mode,where tests are usually written after code, so as to match the code that is written.
But TDD says just the opposite.
Code to make the tests pass...Just pass..Nothing more and Nothing less.
Thats where the catch is where most of we developers might find it difficult and needs getting used to.Not getting more into it as I would not be the best to comment on it :)
So whats refactoring got to do here.
Refactoring plays an integral part of TDD,so that the code is elegant and conveys just what it needs to,avoiding duplication.
The TDD approach also assists in refactoring as you have tests readily available to assure that the functional behaviour is not affected while changing the code design.You are just click of a button away if you are having a automated test scripts (like nUnit) in veryfying refactoring.
So both TDD and Refactoring goes hand in hand and helps in greatly improving the overall code quality.
There are quite a lot resources out there on these.
The best for refactoring would be of Refactoring: Improving the Design of Existing Code.
For TDD Test-Driven Development in Microsoft .NET (Microsoft Professional) would be a good start and also the one by Kent Beck Test Driven Development: By Example
Rahul Nath Newsletter
Join the newsletter to receive the latest updates in your inbox.