History and Design Goals


C# (pronounced "see sharp" or "sea sharp") is a new language developed to run on the .NET Common Language Runtime (CLR).

A Brief History of C++ and C#

All languages make a trade-off between simplicity and power. Of the Microsoft languages, Visual Basic has placed a higher priority on simplicity and productivity than on power. Visual C++, on the other hand, provides a tremendous amount of power, but it's also a more complex and less productive language.

The Visual C++ team has talked about a "simpler C++" for a number of years . Such a language would be like C++, but would be much simpler and more productive to use. We explored a few ideas of what "simpler and more productive" might mean, but it wasn't clear what the right mix of features would be ”or who the target audience should be.

As the .NET project coalesced out of a number of Microsoft projects, it became clear that the .NET environment would provide many of the features to build a "simpler C++" and that the new platform would have a large target audience. It was also clear that there should be a C++-based language for the .NET platform.

What wasn't clear was what that language should be. After considerable discussion, two possibilities emerged.

The first possibility was to modify the C++ language to support the .NET runtime environment. When doing this, either one could go the minimalist approach, extending the C++ language with extensions in the usual manner, or one could go whole hog and build in .NET support at the syntax level, adding new constructs and modifying existing ones.

The second possibility was to develop a language in the spirit of C and C++, but without some of the baggage associated with the existing\animtext4 languages.

It turns out when you talk to programmers about languages, they have some very strong ideas of what a language should be. One of those ideas is that C++ should be C++ and that you shouldn't monkey with the syntax in a non-C++ way. [1] Discussions with developers made it clear that people saw the benefits of a language that was "native" to the .NET way of doing things and that they did not want us to "bastardize" C++ to be that language. [2] They did, however, want to be able to use their existing C and C++ code from the .NET world.

[1] It's very interesting that you can show someone a bit of syntax in C#, and he or she will say, " That's cool!" If you show the same person the same bit of syntax and say it's in C++, he or she will say, " You broke C++!"

[2] To be clearer, they didn't want us to modify C++ and still call it C++.

The decision was therefore made to pursue both avenues. The C++ team extended the C++ language to work in the .NET world, and the C# team designed a new language.

C# Design Goals

The Perl Reference Manual says something like "Perl is a language for getting things done." While C# doesn't subscribe to this philosophy to the same extent that Perl does, [3] it is at its core a pragmatic language. It contains powerful abstractions such as properties, along with "get the job done" features such as unsafe code.

[3] I don't think any language does to the extent Perl does

The C# design philosophy can be summarized in a few design goals.

Be Comfortable for C++ Programmers

C# is targeted at C++ programmers, and it therefore needs to be comfortable for programmers used to C++. To meet this goal, the C# syntax is based on the C++ syntax, with changes made only when necessary. "When necessary" is obviously in the eye of the beholder, but it's fair to say that we either needed to see a clear benefit to the change or needed the change to work with the runtime.

Fit Cleanly into the .NET Common Language Runtime

Because C# runs only on the Common Language Runtime, there is no need for any abstraction between the language and the runtime environment. Therefore, the abstractions that appear in the language are largely those of the runtime itself, and the user doesn't need to keep two different models in mind.

Simplify the C++ Model

Although C# is a child of C++, working in the Common Language Runtime and making the programmer more productive required a fair number of changes from the C++ way of doing things. Some of the simplifications include the following:

  • Getting rid of the separate header file and the preprocessor

  • Getting rid of memory management issues, by using a reference-based system instead of a pointer-based system, along with the runtime garbage collector

Provide the Right Amount of Flexibility

It's very important that there be enough flexibility in the language to support the code that people need to write, but it's also important that there isn't too much flexibility, as additional flexibility usually means additional complexity. Making a language more complex to give the user another option isn't always a good thing; you have to weigh the improvement in the option versus the increased complexity of the language.

Support Component-centric Development

The only business of C# is the creation of components . C# directly addresses some of the issues surrounding the creation of components, including versioning, design-time information, and more.



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net