Sponsored Link •
Bill Venners: You have said that where Java is striving for platform independence, .NET is striving for interoperability. What do you mean by interoperability?
Anders Hejlsberg: Interoperability means several things. First, it means interoperability between various programming languages in .NET. Our design goal was that the .NET CLR would be language neutral, that it would support multiple programming languages. Java, by contrast, was one programming language and execution machinery for that one programming language. The CLR supports many features that have surfaced in only a few programming languages, for example, pointers. Unsafe code in C# and managed C++ have pointers, but Visual Basic and JScript don't. Yet all the infrastructure for pointers is in place in the CLR. Language interoperability is about the realization that as much as we try we're not going to convince everybody that you just program in one programming language. And honestly the way that the industry moves forward and innovation happens is by new programming languages being created. And we're not going to try to stop that. We're going to encourage it.
Another aspect of interoperability is interoperability with existing systems. Back when we were in the Java business, one of the things that we tried to improve upon in our Java VM was interoperability with existing code, because we just think that kind of interoperability is so key. And we still think that. In the CLR, therefore, we have focused very heavily on interoperability with DLLs,COM, OLE automation—all of these technologies that any piece of code was written in before .NET.
It goes back to what I said earlier [In Part IV] that the key today is leverage. We've got to find ways for our programmers to leverage existing systems and code. Achieving that goal means having great interoperability, because how else can you leverage? That puts us in a complete opposition to Java's "100% Pure" viewpoint of the world. And I think we're doing the right thing with it. I really do.
If you contrast what it feels like to call a DLL from C# versus to do it from Java, you'll very quickly see what I mean. It is very complicated to use JNI, and I think it is a pity that they haven't done anything better there, because so much more could be done. It doesn't make sense that the minute you have to interoperate with any other system in the world you enter this netherworld that is quite possibly more complicated than straight C or C++ programming. You have to run all these tools that spit out some header files. You have to remember to call this and that. If you want to dereference an object, you better remember to lock it down else it could, in one out of a thousand cases of running your program, move when the GC somehow happens to sweep right then. Then you can never reproduce it again. If it's OK for a system to do garbage collection and type safety and all, why shouldn't it help you interoperate? It just seems like such a reasonable thing to do.
Bill Venners: From my perspective looking in from the outside of both Microsoft and Sun, I've noticed a cultural or philosophical difference between the two companies that I think influences the design differences between Java and .NET. At Microsoft, I get the sense that the prevailing view is that software is written to program the hardware—the box, the device, and so on. I think that's a totally reasonable perspective given how Microsoft makes its money. By contrast, even though "The network is the computer" was a Sun marketing slogan, I find that attitude really does exist in Sun culture to a great extent. The network offers the services, not the box. And Java is really like an object-oriented layer sitting on top of the network stack, aimed at abstracting away the heterogeneity connected to the network.
Anders Hejlsberg: What's interesting is that any Java solution you care to point at in the real world has platform-specific stuff in it. I know of nothing that is pure Java only, that doesn't somehow rely on some other component. Any of the web stuff relies on Apache or some web server, some database, and some form of interoperability with those systems. It's just ridiculous to think that the whole world is pure Java. The whole world is about putting systems together and making them work. And that's why the whole world is so excited about things like web services, because they're a wonderful way to interoperate. And we just think interoperability comes in many forms and we should just push as hard as we can and make it better and easier for systems to interoperate.
Bill Venners: Actually, the scenario you just described is exactly what I have on the Artima.com server. I have Tomcat running JSPs, and Tomcat does talk to Apache.
Anders Hejlsberg: And you probably have a database.
Bill Venners: Yes, the Java application also talks to a database. There is platform-specific stuff in the sense that the Java API implementations use JNI, but the code of my application is all Java. And in my case even the connectors from Tomcat to Apache and the database are pure Java, because they use sockets to interoperate, not JNI.
Bruce Eckel: One of the things that I like about Python is that it says if you want to be platform independent you can, if you want to talk to the platform, you can.
Anders Hejlsberg: Yes, exactly. It should be your choice.
Come back Monday, November 10 for part III of a conversation with Java's creator James Gosling. I am now staggering the publication of several interviews at once, to give the reader variety. The next installment of this interview with Anders Hejlsberg will appear in the near future. If you'd like to receive a brief weekly email announcing new articles at Artima.com, please subscribe to the Artima Newsletter.
Deep Inside C#: An Interview with Microsoft Chief Architect Anders Hejlsberg:
A Comparative Overview of C#:
Microsoft Visual C#:
Anders Hejlsberg was not the first Artima interviewee to mention taste. Jim Waldo made almost
an identical comment about building a team of tasteful programmers in his interview:
And an entire portion of Ken Arnold's interview was devoted to design taste - Taste and Aesthetics: