Developer

The choice between C# and Java is a platform issue

Language zealots may argue the technical merits of C# vs. Java, but one Builder member suggests that's not the most meaningful debate. He says the language you use should depend on the platform you're coding for.


Rewind to 2000: I am managing a product development effort at a 100 percent pure Java software company. The phone rings. It’s Tim, who’s called to tell me about some new language Microsoft is releasing called C#. Worthless effort; they’ll be too far behind, I respond. I argue that Java is already embedded in the enterprise and Microsoft won’t be able to make headway.

Fast forward to present day: Currently, I am involved with several development projects, nearly all using C#. What happened? Mostly, I’m building software that needs to run only on the Microsoft Windows platform.

I think any software program that needs to run on multiple platforms should absolutely, at this time, be built using Java. I say "at this time" because in the future we may have CLRs for platforms other than Windows. Some of these are already in the works, but they are not yet “there.”

So I advocate Java over C# where portability is a concern. But if you're coding for the Windows platform, I'd argue in favor of using C#. Here's why.

Productivity is the key
Of course you can develop applications for the Microsoft platform using Java. But I think it's more sensible to use a .NET language instead for one simple reason: productivity. Microsoft makes it easier to take advantage of the Windows platform than Java does. Creating Windows services, writing to event logs, debugging SQL Server stored procedures, accessing the registry, working with COM—all of these are simpler in terms of time to market in .NET than they are in Java. It's not that C# is better than Java. But Microsoft has created all the classes to handle Windows-based tasks and made them available through wizards, drag and drop, and point and click.

Java is designed to be platform independent, so naturally it doesn't ship with as many Windows-rich features. Java developers who sit through the .NET classes often let out audible gasps, followed by jokes about how Microsoft is putting developers out of jobs because of the ease by which much .NET development is done.

The .NET decision
A debate on the technical merits of one language vs. the other is for the most part a moot discussion; you can pretty much do the same things in both languages, with minor exceptions. So at this point, your decision should be based on the answer to this question: “Does the application need to run only on the Microsoft platform?” If the answer is yes, go with a .NET language—primarily C#.

Bear in mind that we will, no doubt, eventually see .NET-written applications run on Linux and other platforms, but that day is still some time away. For now, pick your platform first and your language second.

Editor's Picks

Free Newsletters, In your Inbox