Recently, I was doing some refactoring with a C# team. We were moving along well, but there were some annoyances. One of them was the back and forth navigation that we had to do whenever we choose to extract a method: Make the method abstract in a base class and then override it in a derived class. It was a series of refactoring steps that the available C# refactoring tool couldn’t deal with, and it was bit harder than it would’ve been if we were using Java.

Why?

Well, the problem was the override/virtual syntax in C#. When you have a method that you’d like to override, you have to go to it, make it virtual and then go to the overrides and explicitly mark them with the override keyword.

The thing is, I know why they designed .NET this way. Microsoft has always tried to enable clean incremental deployment of software. It’s been a concern for them from the beginning. COM was designed specifically to allow incremental deployment and MFC was written the way it was to avoid the fragile base class problem.

So I understand that Microsoft wanted to make redeployment of base classes safer, but, really, I wish that I didn’t have to retype and adjust declarations to do it. The IDE should help more.

A year or so ago, I met up with Ivan Moore and he was talking about a tool he wanted to write for Java. What it would do is load up a set of classes and add private to the declaration of every field and method that could be private. It was a cool idea, and he had a very cool name for it: Thatcher (it privatizes things).

Some friends and I were talking to him about it and although many of us agreed that it would be a great tool to have, a few of us were a bit apprehensive. We’d been burned by frameworks that were overly restrictive and we felt that if private were a tool-generated default, it could be misused rather badly.

As we spoke, we had another idea. What if your IDE did the analysis for you, and visually marked every field and method that that was not used outside the class? Would that be enough?

Yes, there are a lot of things to think about. One is the scope of analysis. Another is social effect of replacing prohibition with information. But, in general, I don’t think we make our IDEs do enough of this work. It would be great to have a Haskell editor that derives and shows you the type signature of a function, or a C++ IDE that annotates a view with markers for side-effects. There is a lot that can be done.

I know it's weird to say that IDEs don't do enough for us in a time when nearly all IDEs give you incremental compilation, refactoring, code completion, and hints. But, sadly, the fact that all of that is possible now hasn't yet touched or influenced language design in the mainstream. And it should.

If we ask our tools to give us more information about our programs we might find that we have less to type, and less to change when we do need to make changes. I think I'd like that.