Omer van Kloeten's .NET Zen

Programming is life, the rest is mere details

News

Omer van Kloeten's Facebook profile

Omer has been professionally developing applications over the past 8 years, both at the IDF’s IT corps and later at the Sela Technology Center, but has had the programming bug ever since he can remember himself.
As a senior developer at NuConomy, a leading web analytics and advertising startup, he leads a wide range of technologies for its flagship products.

Get Firefox


powered by Dapper 

.NET Resources

Articles :: CodeDom

Articles :: nGineer

Culture

Projects

Testing Obsolete Methods

I was at the TDD Workshop today and got my perspective adjusted on the matter of Unit Testing.

As I was trying to attack the method in my mind from different angles on my way back home, I came to the question of using Unit Tests on methods marked as Obsolete.
After all, Unit Tests are supposed to check that your code is all right whenever you run them. If your code uses Obsolete methods, this means that soon enough, it might not run and even not compile. Using nightly builds with unit tests will not reveal this matter, since using an Obsolete method raises only a faint warning.

Consider the following:
The Red Team is the infrastructure team for The Blue Team at Gulch inc.
The reds decide one day that they are going to refactor their code and decide to kick some methods out the door. Like every other polite team, they decide to keep the old methods, but place an ObsoleteAttribute on them.
The blues get the new set of assemblies and run all of their unit tests on them to see that their code is still all right. It is, since the Obsolete methods still run, but it's not okay to use them.

I think that if the unit tests would warn in a way (or even fail), that the code uses an Obsolete method, nightmares like the ones Raymond has would just not occur (yes, only for people who use Unit Tests, you cynics ;).

What do you say?

Comments

Ido Samuelson said:

If the red team is gonna change its interfaces with blue team in the future, it should notify the blue team about those changes. Obsolete is step one, and more steps are required, some are code changes.
# June 29, 2004 1:33 AM

Omer van Kloeten said:

Sure, but what will make the blue team change their code? It _works_!
I'm working with the zero-trust principal here.
I think I'll write about it soon.
# June 29, 2004 12:50 PM

TrackBack said:

# October 8, 2004 8:49 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)