发信人: Gerdo (魔石之主), 信区: DotNet
标 题: [FWD]C#4JavaErs - Ch1 - Overview of .NET
发信站: Unknown Space - 未名空间 (Sat Oct 18 20:54:58 2003) WWW-POST
Overview of .NET
The .NET label is frequently applied to a broad range of technologies,
products, and marketing initiatives, much the same as the Java label.
Specifically, the scope of the .NET initiative can be broken down into the
following five areas:
The .NET Framework
Devices and clients
Building block services
The .NET Framework
The .NET Framework is roughly equivalent to the Java platform, consisting of a
set of class libraries and a run-time execution environment, not unlike the
Java Virtual Machine. Java binds these two items together with the Java
Language Specification, whereas the .NET Framework is designed to support
multiple languages, including C# and modified forms of Visual Basic and C++,
and so does not include a single language specification.
Microsoft Intermediate Language
The Microsoft intermediate language (MSIL) is the equivalent of the Java byte
code system. When compiling a Java source file, the compiler generates a class
file that contains Java byte codes representing instructions for the virtual
machine. Because these instructions will be interpreted at run time and are
not the native instructions of a processor, byte codes are known as an
intermediate representation of the application logic.
When a C# source file (or a source file containing any other .NET-compatible
language) is compiled, the output consists of MSIL instructions. Like Java
byte codes, MSIL is an intermediate representation and must be compiled to
native instructions in order to be executed; this task is delegated to the
common language runtime, discussed next.
The Common Language Runtime
The common language runtime (CLR) is responsible for managing the execution of
code and providing core services such as automatic memory management,
threading, security, and integration with the underlying operating
system-responsibilities similar to those of the Java Virtual Machine.
Before MSIL can be executed, it must be translated into native code, which is
specific to a particular CPU. This process is called just-in-time (JIT)
compiling and is a core feature of the CLR. MSIL cannot be interpreted like
Java byte codes; the JIT cannot be disabled.
The tight integration between the Windows operating system and the format of a
.NET application means that the CLR is invoked automatically when a .NET
application is started.
The Common Type System The CTS defines how types are declared, used, and
managed at run time. The CTS is an important part of the .NET cross-language
support and provides the basis for types written in one language to be used in
The Common Language Specification The Common Language Specification (CLS) is a
subset of the CTS. Components that conform to the CLS are guaranteed to be
usable by any other component that conforms to the specification. For more
information, see Appendix E, "Cross-Language Code Interoperability."
Base Class Libraries
Like Java, the .NET Framework includes a rich set of libraries that a
programmer can use and extend during the development process. All of the types
contained in the class libraries are CLS-compliant and can be used from any
language whose compiler conforms to the CLS, including the C# compiler.
The scope of the .NET class libraries is similar to that of the Java libraries
and includes types that
Represent basic data types and exception
Support I/O and networking
Support reflection of types
Support platform and application security
Integrate with the underlying operating system
Provide services for constructing GUI applications
Provide access to databases
Support the development of XML Web services
More Info Chapter 2, "Comparing Java and .NET Technologies," provides a
high-level comparison of the Java and .NET class libraries. Part III,
"Programming .NET with C#," and Part IV, "Advanced Topics," demonstrate how to
program the .NET class libraries with C#.
A computing platform is of little use without the tools and languages
necessary to develop applications for it. .NET provides a larger, more
sophisticated set of development tools than the standard Java software
development kit. The J2SDK provides the minimal set of tools that are required
to compile and run Java applications, which leaves the development of more
advanced tools to third parties. Microsoft, on the other hand, with a long
history in the development tool market and a large established developer
community, has updated and expanded its existing range of tools and languages
to support the .NET environment.
The J2SDK ships with a set of command-line tools necessary to compile and run
Java applications; the same is true of the .NET SDK. Both are freely available
and can be used to develop commercial applications for their respective
Integrated Development Environment
Many programmers prefer to work with a graphical integrated development
environment (IDE) instead of the command-line tools. A good IDE can
dramatically increase the productivity of a developer and make development a
more pleasant experience, especially when designing user interfaces.
There is no standard IDE for the Java platform. Many third-party organizations
offer both free and commercial IDEs; the quality and utility of these products
As part of .NET, Microsoft has released Visual Studio .NET, the latest version
of the popular Visual Studio development environment. Visual Studio .NET is a
common development platform for all .NET technologies, comes with support for
developing applications in all Microsoft .NET languages, and offers all the
features expected of a modern IDE.
The strength of Visual Studio .NET lies in its deep integration with the .NET
platform, offering development time integration with some of the .NET servers
such as Microsoft SQL Server and Microsoft Internet Information Services.
Multilanguage support and integration is a fundamental design goal of the CLR
and is critical to promoting adoption of the .NET platform from all areas of
the development community. The strength of the .NET language support is that
components produced in one language can be consumed by another; for example, a
managed C++ application can make use of a C# library. The requirement is that
components must conform to the CLS; it is possible to develop components with
one .NET language that cannot be consumed by another. Consult Appendix E for
more information about complying with the CLS.
Microsoft currently provides three languages as part of .NET: Visual Basic
.NET, Microsoft Visual C++ .NET, and Microsoft Visual C# .NET. In addition,
Microsoft Visual J# .NET is currently in beta.
Visual C# .NET Unlike the other .NET languages, C# has been designed from the
ground up to support the .NET Framework. The design of a programming language
is shaped by the success and failure of earlier designs. The Java language
includes many elements from C and C++ but excludes many more that were
considered unsafe or difficult to use.
The designers of the C# language and the .NET Framework have clearly been
influenced by Java, C, and C++ but have taken a fundamentally different
approach to resolving conflicts in safe design. A great deal of effort has
been made to ensure that the developer can easily write safe and robust code,
but features that are considered to be dangerous are still available to the
advanced or legacy programmer who can explicitly indicate the need to step
outside the limitations of safe code.
Although the .NET platform has only recently been released, comparisons
between Java and C# are natural because of the many similarities. Generally,
these comparisons tend to focus solely on the obvious structural and syntactic
similarities, whereas a deeper exploration reveals fundamental differences and
a wealth of new features available to the C# programmer.
Fortunately, the strong influence of the Java language allows experienced Java
programmers to learn the basic C# language quickly, and with less difficulty
than a C/C++ programmer. However, some C# features are derived from elements
of C or C++ that were excluded from Java and that may be difficult to
appreciate from a pure Java perspective.
Visual Basic .NET Visual Basic .NET is the latest release of the popular
Visual Basic language. While still maintaining many similarities with previous
versions, Visual Basic .NET has undergone significant change and expansion to
provide support for the .NET platform.
Visual C++ .NET Visual C++ .NET provides nonstandard extensions to the C++
language that allow developers to create C++ applications that take advantage
of the .NET platform.
Visual J# .NET Visual J# .NET is a language compatible with Microsoft Visual
J++. We discuss J# in the "Platform Migration and Integration" section later
in this chapter.
JScript .NET JScript .NET is an implementation of the ECMA 262 language
JScript .NET is an object-oriented scripting language that can use the
underlying features provided by the .NET Framework.
Other languages Third parties have already implemented .NET versions of more
than twenty familiar languages. Many of these languages have been extended to
meet the requirements of .NET and offer new features provided by the .NET
platform. Table 1-1 contains some of the more prominent languages implemented
for the .NET platform and provides a link to where additional information can
be found. A search on .NET languages at www.microsoft.com will lead you to a
more complete list.
Table 1-1: Third-Party .NET Languages Language
The .NET server range consists of a set of rebranded and updated versions of
existing Microsoft server products. The .NET server functionality covers
everything from operating systems and relational databases to process
integration and communications. The range currently includes the following
Microsoft Application Center 2000
Microsoft BizTalk Server 2000
Microsoft Commerce Server 2000
Microsoft Content Management Server 2001
Microsoft Exchange Server 2000
Microsoft Host Integration Server 2000
Microsoft Internet Security and Acceleration Server 2000
Microsoft Mobile Information Server 2001
Microsoft SharePoint Portal Server 2001
Microsoft SQL Server 2000
The integration of Microsoft server products into the .NET platform is still
in its earliest stages. To date, most efforts have been focused on adding
support for the XML Web services application model to existing products,
reflecting the importance Microsoft places on this technology. Over the coming
years, this situation will improve: integration will deepen and functionality
will increase with the release of new products.
The inclusion of Microsoft server products into .NET highlights one of the
primary differences between .NET and Java. The Java platform is vendor
independent and provides no products, relying on third parties to provide
A Java application server provides a J2EE-compliant environment in which to
run enterprise Java applications. Many vendors provide application servers,
sometimes with their own set of functionality and extensions to the J2EE
specification. Because many of these servers provide similar functionality to
the .NET servers, the .NET server market is an area where Microsoft is
expected to face intense competition.
Devices and Clients
The .NET Framework runs on a broad range of Windows versions, including
Windows 98, Windows Me, Microsoft Windows NT 4.0, Windows 2000, and Windows
XP. .NET also targets a new category of client called smart devices; Microsoft
considers smart devices to be clients that can consume XML Web services. The
list of Microsoft devices that are classified in this manner includes
Pocket PC 2002 PDAs
The Microsoft Smartphone Platform
Microsoft also provides a limited version of the .NET Framework for use on
devices, known as the .NET Compact Framework, which is a direct competitor of
the Java 2 Micro Edition (J2ME) platform.
Building Block Services
The .NET building block services are a set of XML Web services that provide
globally accessible functionality commonly required in distributed systems
development. Microsoft has begun a process of making some of its product
offerings available via XML Web services and developing new services to drive
the adoption of the .NET product set.
Early offerings from this process include Microsoft Passport (a single point
of authentication) and MapPoint .NET (which offers map generation and location
services). The attraction of XML Web services to Microsoft (and to other
companies) is that the revenue model tends to be per-user, offering a
recurring revenue stream that is not reliant on users purchasing upgrades.
Although the business model behind XML Web services is unproven, many
companies are developing tools and services to exploit this technology. XML
Web services have clear benefits in simplifying existing business processes
and allowing systems from different vendors to operate, but the value of XML
Web services as consumer service offerings will not be clear until a critical
mass of quality services is available.
More Info See Chapter 19, "Introduction to XML Web Services," for more
information on using the .NET Framework and the C# language to develop XML Web
※ 来源:．Unknown Space - 未名空间 mitbbs.com．[FROM: 24.48.]