Galaxy S23 Ultra Review ChatGPT and Microsoft Bing 5 Things New Bing Can Do How to Try New Bing Ozempic vs. Obesity Best Super Bowl Ads Super Bowl: How to Watch Massive Listeria Recall
Want CNET to notify you of price drops and the latest stories?
No, thank you

Tuning up for C#

Seeking new technology to protect its software empire, Microsoft turns to Anders Hejlsberg, creator of the programming language that is its answer to Java.

When Microsoft needed a new technology to preserve its software dominance, it turned to Anders Hejlsberg.

The 40-year-old software guru had won the respect of more than a million software developers who embraced Borland's Turbo Pascal and Delphi, two tools he created to help programmers write their software.

Now Microsoft is hoping developers will flock to his latest creation: the C# software programming language, a crucial piece of Microsoft's new software strategy that moves its Windows operating system and software to the Web.

After several years of development, C# (pronounced "C-sharp") is the Redmond, Wash.-based company's answer to one of its biggest threats--the Java language created by rival Sun Microsystems and supported by two other fierce Microsoft competitors, Oracle and IBM.

With software companies racing to make applications available as a service over the Internet to PCs and handheld devices, Microsoft is hoping the companies will write their Web-based software and services using C# instead of Java. And Microsoft is hoping businesses will choose its .Net family of e-business software to run Web services, instead of software based on Java.

Java, however, is six years old, and C# is still in Microsoft's womb. While test versions are available, the company's final version of the C# software development tool won't ship until late this year at the earliest.

Analysts view C#--which, like Java, traces its roots back to the C++ language--as Microsoft's way of keeping its legions of C++ developers from switching to Java.

For example, C# copies features that Java offers, including "garbage collection," a popular feature that greatly reduces the complexity of software development by tidying up the computer memory a software program uses. It also includes a universal engine that lets programmers use many types of programming languages to write their applications, meaning they don't need to learn a new language such as Java to build their Web software.

In an interview with CNET, Hejlsberg, a Microsoft distinguished engineer, discusses the genesis of C#, the future of Web services, and why he thinks his new invention is better than Java.

Q: Why did you create C#? Was it to update the C++ language, or was it to compete against Java?
A: The evolution of programming languages is very glacial. We're building on the shoulder of other languages, be it Java, C++ or Smalltalk. We take something from old languages. It's mixing the right features together. There's so much out there. We are not going to be the final programming language to end all programming languages. It's an evolutionary world, and that's how it works.

There were several design goals. On top of everything, it was to make sure programmers are more productive. We wanted to start with something they know--C++--and simplify the language. We wanted to have the power and expressiveness of C++, but with the ease of Visual Basic (a Microsoft tool that lets programmers build software with minimal coding). C++ needed updating. We needed to change it as little as possible but add a bunch of new features like garbage collection.

So, who are you targeting with C#? Is it a programmer that uses C++? Java? Visual Basic?
If you look at the heritage of the language, it's C and C++. They have a family tree of languages which includes Java. And so that's the primary audience.

Do you think C# will compete well against Java?
Keep in mind that Java is five years older than the .Net platform. We haven't shipped products yet. Companies don't bet on beta (test) releases. In five years, the marketplace will look different. In five years, it's more of an apples-to-apples comparison. But (the companies testing C#) are liking what they see.

What are the top three reasons why a software developer should use C# over Java?
When you say Java, I'm going to assume you're talking about Java the language. Sometimes people mean Java the platform. We have different names for the two things: C# for the language, and the .Net platform.

I would say C# is closer to C++. A lot of Java has close ties to C++, but if you look at its model, there were some things removed. C# sacrifices fewer things.

C# is also the first language to introduce component-oriented properties and methods and events. (Components are prefab pieces of software code that programmers can snap together like Lego blocks to create applications. Properties, methods and events are ways that programmers can automate tasks such as responding to mouse clicks or writing software modules.)

Like when you click a button, you can declare an event called "click." With Java, you have to emulate properties and events, even though they have a component model called JavaBeans. You can do it in Java, but it's a lot harder.

I would argue that interoperability is another key. Java was platform-independent (meaning that Java software can run on any hardware or operating system), but we're saying it's important to leverage existing software. We bent over backwards to do that. We provide great interoperability (with existing C++ code, for example) without having to write "glue" code.

A big difference between the two platforms is that, when we started out two or three years ago, we knew from the get-go that we wanted to target this new Internet applications world. If you look at Java, Web services are an afterthought.

A lot has been said about Sun's failed efforts to turn Java over to an industry standards body for fear of losing full control of the language they created. They instead chose to create a "Java Community Process" that allows Java supporters to change and update the technology as needed. Microsoft certainly tweaked Sun when it submitted C# to a standards committee. What's the update? How's that working out?
Our approach is very different from Sun. They first submitted it to (standards bodies), then withdrew their submission. By taking C# to the standards process...we're not just looking for a rubber stamp. We're working with our co-sponsors like Hewlett-Packard and Intel. In the process, we've made changes to our product based on feedback from the committee work.

Every large software maker has come out with their Web services vision. But it seems so pie in the sky. When will this scenario really become reality? One scenario that's often touted is the idea that your cell phone can warn you that your flight has been canceled and that it automatically books you on the next flight.
A lot of it is very close. There are a lot of things you can do today that you will see happening in the next year. Companies that offer services on an auction site, for example. Today, when we use the Internet, it is largely a human-to-machine interaction. With Web services, you're leveraging that same infrastructure from machine to machine. It's a natural evolution. So, for example, you can have a Web portal site that shows your e-mail and calendar, but also aggregates all the auction items you have up for bid, and you can put that together in a smart device or PC.

Some scenarios are more pie in the sky than the others...You need to connect smart devices to the world at large. You put in place the plumbing with which that connectivity will happen. We have to get broadband. We need more (voice, video and data) throughput on wireless (devices). All those things happen in parallel.