Thursday, September 18, 2008

Statically typed language - old man's unit tests

After implementing GUI testing support that should allow me to write acceptance tests, I am finally getting to the refactoring of our "tween" application, piece by piece. The foal is to cleanly separate GUI from business logic. The business reason to do this is to put some long-running task into background, but I also have a long-term intent of unlocking 12 years worth of business logic from the obsolete XWindows GUI and putting a better, faster face on it.

Well, there are no unit tests at all available for me to verify that this stuff still works. But it's C++, so I can be pretty sure that replacing f->x[i] with f->x(i) will not break anything as long as the compiler is satisfied.

And that brings me to the title of the post. Without tests covering every single line I change, I would not dare to do what I am doing in Python, perl or Smalltalk. In C++, I can risk it because I can limit myself to such step that can be verified with compilation and a simple acceptance test. So. Static types are useful for some things, anyway.

No comments: