Tuesday, February 15, 2005

Creating a new API

So we're changing the way we do something in our system, it is functionality that has existed for a long time, but is getting a new API. There have been two approaches taken, when building this. In one we have refactored the old calls to look like the new calls (sometimes difficult). In another we have used TDD to write the new calls.

I way prefer the refactoring method. The TDD driven way appears quicker - at first. It assumes that you have captured all the tests. Well, what you are losing is the code history. The code has been shaped into however a poor form usually to meet a wide range of requirements, that may be expressed in many different tests. By replacing those tests with new ones - you lose the experience.

Refactoring may be harder, but it keeps the experiences. You are forced to touch and acknowledge the past experiences of the code. Removing one becomes very explicit (a design change) rather than an oversite. Best of all - the original tests continue to work.

0 Comments:

Post a Comment

<< Home