Martin Fowler has a new bliki entry on the difference between public interface and a published interface. I think Martin is dead-on in his statements, so much so that I would favor seeing the next generation of programming languages support a published keyword to better differentiate from public. In theory, public should be good enough, but practical experience shows otherwise.

Unfortunately, languages change slowly, and popular new languages are introduced at rare intervals. So in the meantime, I am going to leverage the metadata capabilities of the .NET runtime with the PublishedAttribute class that I just coded up. Feel free to download it for yourself.

I would love to see Microsoft adopt something similar into the .NET base class libraries. The compiler could warn you about usage of unpublished classes, or even completely disallow usage along the same lines as unsafe code. The auto-complete in the editor could grey out unpublished interfaces, or hide them completely at your option. This has got to be better than the hateful

The Foo type supports the .NET Framework infrastructure and is not intended to be used directly from your code.

documentation that we have today.