Internet environment, there are still features that it lacks. One is
cross
language to work easily with the code produced by another. Cross-language interoperability
programming software components because the most valuable component is one that can
be used by the widest variety of computer languages, in the greatest number of operating
environments.
6
P a r t I :
T h e C # L a n g u a g e
Another feature lacking in Java is full integration with the Windows platform. Although
Java programs can be executed in a Windows environment (assuming that the Java Virtual
Machine has been installed), Java and Windows are not closely coupled. Since Windows is
the most widely used operating system in the world, lack of direct support for Windows is a
drawback to Java.
To answer these and other needs, Microsoft developed C#. C# was created at Microsoft
late in the 1990s and was part of Microsoft’s overall .NET strategy. It was first released in its
alpha version in the middle of 2000. C#’s chief architect was Anders Hejlsberg. Hejlsberg is
one of the world’s leading language experts, with several notable accomplishments to his
credit. For example, in the 1980s he was the original author of the highly successful and
influential Turbo Pascal, whose streamlined implementation set the standard for all future
compilers.
C# is directly related to C, C++, and Java. This is not by accident. These are three of
the most widely used—and most widely liked—programming languages in the world.
Furthermore, at the time of C#’s creation, nearly all professional programmers knew C, C++,
and/or Java. By building C# upon a solid, well-understood foundation, C# offered an easy
migration path from these languages. Since it was neither necessary nor desirable for Hejlsberg
to “reinvent the wheel,” he was free to focus on specific improvements and innovations.
The family tree for C# is shown in Figure 1-1. The grandfather of C# is C. From C, C#
derives its syntax, many of its keywords, and its operators. C# builds upon and improves
the object model defined by C++. If you know C or C++, then you will feel at home with C#.
C# and Java have a bit more complicated relationship. As explained, Java is also
descended from C and C++. It too shares the C/C++ syntax and object model. Like Java, C#
is designed to produce portable code. However, C# is not descended from Java. Instead, C#
and Java are more like cousins, sharing a common ancestry, but differing in many important
ways. The good news, though, is that if you know Java, then many C# concepts will be
familiar. Conversely, if in the future you need to learn Java, then many of the things you
learn about C# will carry over.
C# contains many innovative features that we will examine at length throughout the
course of this book, but some of its most important relate to its built-in support for software
components. In fact, C# has been characterized as being a component-oriented language
because it contains integral support for the writing of software components. For example,
F
IGURE
1-1
The C# family tree
www.freepdf-books.com