News

Father of C# grilled at Microsoft PDC

Discussing the guiding philosophy behind the C# programming language, Anders Hejlsberg quotes Albert Einstein: "Keep it as simple as possible, but no simpler."

Hejlsberg, distinguished engineer at Microsoft and chief designer of C#, was supposed to deliver a speech at OOPSLA 2003 -- the 18th Conference on Object Oriented Programming, Systems and Applications -- in October. But with wildfires making travel in the Los Angeles area even more difficult than usual, he missed the show.

However, when Programmers Report caught up with Hejlsberg a few days later at Microsoft's Professional Development Conference (PDC) in Los Angeles, which was running concurrent with OOPSLA in another part of Los Angeles, he shared a few key points of his undelivered speech.

Hejlsberg pointed out that the latest version of C# included in Whidbey -- the code name for the next version of Visual Studio .NET, which is due for release in the second half of 2004 -- makes creative use of generics.

"The big focus of the Whidbey release is programmer productivity," Hejlsberg said. This includes making sure that when things like generics are used they work properly.

"One of the core philosophies for all these programmer productivity tools that we put in [C#] is that there are lots of tools out there that get it correct 90%, 95% or 99% of the time. But I subscribe to the philosophy that if you can't trust a tool all the time, you have to spend an enormous amount of time learning. When you can't trust the tool, you [need to] work around that [fact]. And then you haven't saved a whole lot," he noted.

"So unless we can guarantee that we do it right," said Hejlsberg, "we will not do it."

In explaining the importance of generics, he pointed out that C# programmers often use a general-purpose container class or list; however, if they are not careful, it can cause overhead problems.

"It's a growable list, so you can add elements to it," Hejlsberg explained. "You can index into the list and take elements out."

The list containing objects is designed to be flexible, so programmers can add elements to suit their application needs. In the world of .NET and C#, object is itself a flexible concept, Hejlsberg explained.

"The nice thing about the .NET Framework and C# is that we have a unified type system so anything -- any piece of data that you deal with in the world -- in .NET can be treated as an object," Hejlsberg said. "If you have an integer, you can treat it as an object. If you have a string or a customer, you can add them to your list."

But he pointed out that as programmers add to the list, there is overhead associated with it; a new generics productivity tool helps to manage potential bloating of code.

As projects increase in sophistication, programmers will need to better reuse and customize existing component-based software. To do this, programmers typically employ a feature called generics.

In Whidbey, the CLR will include a type-safe, high-performance, compile time-verified version of generics. Generics allow developers to author, test and deploy code once and reuse that code for different data types. The CLR implementation of generics will also reduce "code bloat" when compared to other strongly-typed implementations.

Generics simplify the tasks of modifying objects, so C# programmers can concentrate on the creative areas of programming and not worry about housecleaning chores, Hejlsberg said.

"Generics are the ability for you to parameterize your types and create algorithms where some of the typing information is supplied later," he concluded. "It gives you a whole new dimension of flexibility in your coding."

More information on the latest features of C# is available at www.msdn.microsoft.com/vcsharp

Links:

For other Programmers Report articles, please click here.

About the Author

Rich Seeley is Web Editor for Campus Technology.