Sei sulla pagina 1di 22

.

NET Framework
From Wikipedia, the free encyclopedia

(Redirected from .NET (Microsoft))


Jump to: navigation, search

.NET Framework

Developed
Microsoft
by

Latest 3.5.30729.1 (3.5 SP1) / 11 August 2008; 153


release days ago

OS Windows NT 4.0, Windows 98 and above

Type Software framework

MS-EULA, BCL under Microsoft Reference


License
License[1]

Website msdn.microsoft.com/netframework

The Microsoft .NET Framework is a software technology that is available with several
Microsoft Windows operating systems. It includes a large library of pre-coded solutions to
common programming problems and a virtual machine that manages the execution of programs
written specifically for the framework. The .NET Framework is a key Microsoft offering and is
intended to be used by most new applications created for the Windows platform.

The pre-coded solutions that form the framework's Base Class Library cover a large range of
programming needs in a number of areas, including user interface, data access, database
connectivity, cryptography, web application development, numeric algorithms, and network
communications. The class library is used by programmers, who combine it with their own code
to produce applications.

Programs written for the .NET Framework execute in a software environment that manages the
program's runtime requirements. Also part of the .NET Framework, this runtime environment is
known as the Common Language Runtime (CLR). The CLR provides the appearance of an
application virtual machine so that programmers need not consider the capabilities of the specific
CPU that will execute the program. The CLR also provides other important services such as
security, memory management, and exception handling. The class library and the CLR together
compose the .NET Framework.

Version 3.0 of the .NET Framework is included with Windows Server 2008 and Windows Vista.
The current version of the framework can also be installed on Windows XP and the Windows
Server 2003 family of operating systems.[2] A reduced "Compact" version of the .NET
Framework is also available on Windows Mobile platforms, including smartphones.

Contents
[hide]

• 1 Principal design features


• 2 Architecture
o 2.1 Common Language Infrastructure (CLI)
o 2.2 Assemblies
o 2.3 Metadata
o 2.4 Security
o 2.5 Class library
o 2.6 Memory management
• 3 Standardization and licensing
• 4 Versions
o 4.1 .NET Framework 1.0
o 4.2 .NET Framework 1.1
 4.2.1 Changes in 1.1 on comparison with 1.0
o 4.3 .NET Framework 2.0
 4.3.1 Changes in 2.0 on comparison with 1.1
o 4.4 .NET Framework 3.0
o 4.5 .NET Framework 3.5
 4.5.1 Changes since version 3.0
 4.5.2 Service Pack 1
o 4.6 .NET Framework 4.0
• 5 .NET vs. Java and Java EE
• 6 Criticism
• 7 Alternative implementations
• 8 See also
• 9 References

• 10 External links

[edit] Principal design features


Interoperability
Because interaction between new and older applications is commonly required, the .NET
Framework provides means to access functionality that is implemented in programs that
execute outside the .NET environment. Access to COM components is provided in the
System.Runtime.InteropServices and System.EnterpriseServices namespaces of the
framework; access to other functionality is provided using the P/Invoke feature.
Common Runtime Engine
The Common Language Runtime (CLR) is the virtual machine component of the .NET
framework. All .NET programs execute under the supervision of the CLR, guaranteeing
certain properties and behaviors in the areas of memory management, security, and
exception handling.
Language Independence
The .NET Framework introduces a Common Type System, or CTS. The CTS
specification defines all possible datatypes and programming constructs supported by the
CLR and how they may or may not interact with each other. Because of this feature,
the .NET Framework supports the exchange of instances of types between programs
written in any of the .NET languages. This is discussed in more detail in Microsoft .NET
Languages.
Base Class Library
The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library
of functionality available to all languages using the .NET Framework. The BCL provides
classes which encapsulate a number of common functions, including file reading and
writing, graphic rendering, database interaction and XML document manipulation.
Simplified Deployment
Installation of computer software must be carefully managed to ensure that it does not
interfere with previously installed software, and that it conforms to security requirements.
The .NET framework includes design features and tools that help address these
requirements.
Security
The design is meant to address some of the vulnerabilities, such as buffer overflows, that
have been exploited by malicious software. Additionally, .NET provides a common
security model for all applications.
Portability
The design of the .NET Framework allows it to theoretically be platform agnostic, and
thus cross-platform compatible. That is, a program written to use the framework should
run without change on any type of system for which the framework is implemented.
Microsoft's commercial implementations of the framework cover Windows, Windows
CE, and the Xbox 360.[3] In addition, Microsoft submits the specifications for the
Common Language Infrastructure (which includes the core class libraries, Common Type
System, and the Common Intermediate Language),[4][5][6] the C# language,[7] and the C+
+/CLI language[8] to both ECMA and the ISO, making them available as open standards.
This makes it possible for third parties to create compatible implementations of the
framework and its languages on other platforms.

[edit] Architecture
Visual overview of the Common Language Infrastructure (CLI)

[edit] Common Language Infrastructure (CLI)

Main article: Common Language Infrastructure

The core aspects of the .NET framework lie within the Common Language Infrastructure, or
CLI. The purpose of the CLI is to provide a language-neutral platform for application
development and execution, including functions for exception handling, garbage collection,
security, and interoperability. Microsoft's implementation of the CLI is called the Common
Language Runtime or CLR.

[edit] Assemblies

Main article: .NET assembly

The intermediate CIL code is housed in .NET assemblies. As mandated by specification,


assemblies are stored in the Portable Executable (PE) format, common on the Windows platform
for all DLL and EXE files. The assembly consists of one or more files, one of which must
contain the manifest, which has the metadata for the assembly. The complete name of an
assembly (not to be confused with the filename on disk) contains its simple text name, version
number, culture, and public key token. The public key token is a unique hash generated when the
assembly is compiled, thus two assemblies with the same public key token are guaranteed to be
identical from the point of view of the framework. A private key can also be specified known
only to the creator of the assembly and can be used for strong naming and to guarantee that the
assembly is from the same author when a new version of the assembly is compiled (required to
add an assembly to the Global Assembly Cache).

[edit] Metadata

Main article: .NET metadata

All CLI is self-describing through .NET metadata. The CLR checks the metadata to ensure that
the correct method is called. Metadata is usually generated by language compilers but developers
can create their own metadata through custom attributes. Metadata contains information about
the assembly, and is also used to implement the reflective programming capabilities of .NET
Framework.

[edit] Security

.NET has its own security mechanism with two general features: Code Access Security (CAS),
and validation and verification. Code Access Security is based on evidence that is associated
with a specific assembly. Typically the evidence is the source of the assembly (whether it is
installed on the local machine or has been downloaded from the intranet or Internet). Code
Access Security uses evidence to determine the permissions granted to the code. Other code can
demand that calling code is granted a specified permission. The demand causes the CLR to
perform a call stack walk: every assembly of each method in the call stack is checked for the
required permission; if any assembly is not granted the permission a security exception is
thrown.

When an assembly is loaded the CLR performs various tests. Two such tests are validation and
verification. During validation the CLR checks that the assembly contains valid metadata and
CIL, and whether the internal tables are correct. Verification is not so exact. The verification
mechanism checks to see if the code does anything that is 'unsafe'. The algorithm used is quite
conservative; hence occasionally code that is 'safe' does not pass. Unsafe code will only be
executed if the assembly has the 'skip verification' permission, which generally means code that
is installed on the local machine.

.NET Framework uses appdomains as a mechanism for isolating code running in a process.
Appdomains can be created and code loaded into or unloaded from them independent of other
appdomains. This helps increase the fault tolerance of the application, as faults or crashes in one
appdomain do not affect rest of the application. Appdomains can also be configured
independently with different security privileges. This can help increase the security of the
application by isolating potentially unsafe code. The developer, however, has to split the
application into subdomains; it is not done by the CLR.

[edit] Class library

Namespaces in the BCL[9]

System

System. CodeDom

System. Collections

System. Diagnostics

System. Globalization

System. IO

System. Resources
System. Text

System. Text.RegularExpressions

See also: Base Class Library and Framework Class Library

Microsoft .NET Framework includes a set of standard class libraries. The class library is
organized in a hierarchy of namespaces. Most of the built in APIs are part of either System.* or
Microsoft.* namespaces. It encapsulates a large number of common functions, such as file
reading and writing, graphic rendering, database interaction, and XML document manipulation,
among others. The .NET class libraries are available to all .NET languages. The .NET
Framework class library is divided into two parts: the Base Class Library and the Framework
Class Library.

The Base Class Library (BCL) includes a small subset of the entire class library and is the core
set of classes that serve as the basic API of the Common Language Runtime.[9] The classes in
mscorlib.dll and some of the classes in System.dll and System.core.dll are considered to
be a part of the BCL. The BCL classes are available in both .NET Framework as well as its
alternative implementations including .NET Compact Framework, Microsoft Silverlight and
Mono.

The Framework Class Library (FCL) is a superset of the BCL classes and refers to the entire
class library that ships with .NET Framework. It includes an expanded set of libraries, including
WinForms, ADO.NET, ASP.NET, Language Integrated Query, Windows Presentation
Foundation, Windows Communication Foundation among others. The FCL is much larger in
scope than standard libraries for languages like C++, and comparable in scope to the standard
libraries of Java.

[edit] Memory management

The .NET Framework CLR frees the developer from the burden of managing memory (allocating
and freeing up when done); instead it does the memory management itself. To this end, the
memory allocated to instantiations of .NET types (objects) is done contiguously[10] from the
managed heap, a pool of memory managed by the CLR. As long as there exists a reference to an
object, which might be either a direct reference to an object or via a graph of objects, the object
is considered to be in use by the CLR. When there is no reference to an object, and it cannot be
reached or used, it becomes garbage. However, it still holds on to the memory allocated to it.
.NET Framework includes a garbage collector which runs periodically, on a separate thread from
the application's thread, that enumerates all the unusable objects and reclaims the memory
allocated to them.
The .NET Garbage Collector (GC) is a non-deterministic, compacting, mark-and-sweep garbage
collector. The GC runs only when a certain amount of memory has been used or there is enough
pressure for memory on the system. Since it is not guaranteed when the conditions to reclaim
memory are reached, the GC runs are non-deterministic. Each .NET application has a set of
roots, which are pointers to objects on the managed heap (managed objects). These include
references to static objects and objects defined as local variables or method parameters currently
in scope, as well as objects referred to by CPU registers.[10] When the GC runs, it pauses the
application, and for each object referred to in the root, it recursively enumerates all the objects
reachable from the root objects and marks them as reachable. It uses .NET metadata and
reflection to discover the objects encapsulated by an object, and then recursively walk them. It
then enumerates all the objects on the heap (which were initially allocated contiguously) using
reflection. All objects not marked as reachable are garbage.[10] This is the mark phase.[11] Since
the memory held by garbage is not of any consequence, it is considered free space. However, this
leaves chunks of free space between objects which were initially contiguous. The objects are
then compacted together, by using memcpy[11] to copy them over to the free space to make them
contiguous again.[10] Any reference to an object invalidated by moving the object is updated to
reflect the new location by the GC.[11] The application is resumed after the garbage collection is
over.

The GC used by .NET Framework is actually generational.[12] Objects are assigned a generation;
newly created objects belong to Generation 0. The objects that survive a garbage collection are
tagged as Generation 1, and the Generation 1 objects that survive another collection are
Generation 2 objects. The .NET Framework uses up to Generation 2 objects.[12] Higher
generation objects are garbage collected less frequently than lower generation objects. This helps
increase the efficiency of garbage collection, as older objects tend to have a larger lifetime than
newer objects.[12] Thus, by removing older (and thus more likely to survive a collection) objects
from the scope of a collection run, fewer objects need to be checked and compacted.[12]

[edit] Standardization and licensing


In August 2000, Microsoft, Hewlett-Packard, and Intel worked to standardize CLI and the C#
programming language. By December 2001, both were ratified ECMA standards (ECMA 335
and ECMA 334). ISO followed in April 2003 - the current version of the ISO standards are
ISO/IEC 23271:2006 and ISO/IEC 23270:2006.[13][14]

While Microsoft and their partners hold patents for the CLI and C#, ECMA and ISO require that
all patents essential to implementation be made available under "reasonable and non-
discriminatory terms". In addition to meeting these terms, the companies have agreed to make
the patents available royalty-free.

However, this does not apply for the part of the .NET Framework which is not covered by the
ECMA/ISO standard, which includes Windows Forms, ADO.NET, and ASP.NET. Patents that
Microsoft holds in these areas may deter non-Microsoft implementations of the full framework.

On 3 October 2007, Microsoft announced that much of the source code for the .NET Framework
Base Class Library (including ASP.NET, ADO.NET, and Windows Presentation Foundation)
was to have been made available with the final release of Visual Studio 2008 towards the end of
2007 under the shared source Microsoft Reference License.[1] The source code for other libraries
including Windows Communication Foundation (WCF), Windows Workflow Foundation (WF),
and Language Integrated Query (LINQ) were to be added in future releases. Being released
under the non Open-source Microsoft Reference License means this source code is made
available for debugging purpose only, primarily to support integrated debugging of the BCL in
Visual Studio.

[edit] Versions
Microsoft started development on the .NET Framework in the late 1990s originally under the
name of Next Generation Windows Services (NGWS). By late 2000 the first beta versions of
.NET 1.0 were released.[15]

The .NET Framework stack.

Version Release
Version Visual Studio Default in Windows
Number Date

1.0 1.0.3705.0 2002-02-13 Visual Studio .NET

Visual Studio .NET


1.1 1.1.4322.573 2003-04-24 Windows Server 2003
2003

2.0 2.0.50727.42 2005-11-07 Visual Studio 2005

Windows Vista, Windows Server


3.0 3.0.4506.30 2006-11-06
2008

3.5 3.5.21022.8 2007-11-19 Visual Studio 2008

A more complete listing of the releases of the .NET Framework may be found on the .NET
Framework version list.

[edit] .NET Framework 1.0

The old .NET Framework logo


This is the first release of the .NET Framework, released on 13 February 2002 and available for
Windows 98, NT 4.0, 2000, and XP. Mainstream support by Microsoft for this version ended 10
July 2007, and extended support ends 14 July 2009.[16]

[edit] .NET Framework 1.1

This is the first major .NET Framework upgrade. It is available on its own as a redistributable
package or in a software development kit, and was published on 3 April 2003. It is also part of
the second release of Microsoft Visual Studio .NET (released as Visual Studio .NET 2003). This
is the first version of the .NET Framework to be included as part of the Windows operating
system, shipping with Windows Server 2003. Mainstream support for .NET Framework 1.1
ended on 14 October 2008, and extended support ends on 8 October 2013. Since .NET 1.1 is a
component of Windows Server 2003, extended support for .NET 1.1 on Server 2003 will run out
with that of the OS - currently 30 June 2013.

[edit] Changes in 1.1 on comparison with 1.0

• Built-in support for mobile ASP.NET controls. Previously available as an add-on for
.NET Framework, now part of the framework.
• Security changes - enable Windows Forms assemblies to execute in a semi-trusted
manner from the Internet, and enable Code Access Security in ASP.NET applications.
• Built-in support for ODBC and Oracle databases. Previously available as an add-on
for .NET Framework 1.0, now part of the framework.
• .NET Compact Framework - a version of the .NET Framework for small devices.
• Internet Protocol version 6 (IPv6) support.
• Numerous API changes.

[edit] .NET Framework 2.0

Released with Visual Studio 2005, Microsoft SQL Server 2005, and BizTalk 2006.

• The 2.0 Redistributable Package can be downloaded for free from Microsoft, and was
published on 2006-01-22.
• The 2.0 Software Development Kit (SDK) can be downloaded for free from Microsoft.
• It is included as part of Visual Studio 2005 and Microsoft SQL Server 2005.
• Version 2.0 is the last version with support for Windows 2000, Windows 98 and
Windows Me.
• It shipped with Windows Server 2003 R2 (not installed by default).

[edit] Changes in 2.0 on comparison with 1.1

• Numerous API changes.


• A new hosting API for native applications wishing to host an instance of the .NET
runtime. The new API gives a fine grain control on the behavior of the runtime with
regards to multithreading, memory allocation, assembly loading and more (detailed
reference). It was initially developed to efficiently host the runtime in Microsoft SQL
Server, which implements its own scheduler and memory manager.
• Full 64-bit support for both the x64 and the IA64 hardware platforms.
• Language support for generics built directly into the .NET CLR.
• Many additional and improved ASP.NET web controls.
• New data controls with declarative data binding.
• New personalization features for ASP.NET, such as support for themes, skins and
webparts.
• .NET Micro Framework - a version of the .NET Framework related to the Smart Personal
Objects Technology initiative.
• Partial classes
• Anonymous methods

[edit] .NET Framework 3.0

.NET Framework 3.0, formerly called WinFX,[17] includes a new set of managed code APIs
that are an integral part of Windows Vista and Windows Server 2008 operating systems. It is
also available for Windows XP SP2 and Windows Server 2003 as a download. There are no
major architectural changes included with this release; .NET Framework 3.0 uses the Common
Language Runtime of .NET Framework 2.0.[18] Unlike the previous major .NET releases there
was no .NET Compact Framework release made as a counterpart of this version.

.NET Framework 3.0 consists of four major new components:

• Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user


interface subsystem and API based on XML and vector graphics, which uses 3D
computer graphics hardware and Direct3D technologies. See WPF SDK for developer
articles and documentation on WPF.
• Windows Communication Foundation (WCF), formerly code-named Indigo; a service-
oriented messaging system which allows programs to interoperate locally or remotely
similar to web services.
• Windows Workflow Foundation (WF) allows for building of task automation and
integrated transactions using workflows.
• Windows CardSpace, formerly code-named InfoCard; a software component which
securely stores a person's digital identities and provides a unified interface for choosing
the identity for a particular transaction, such as logging in to a website.

[edit] .NET Framework 3.5

Version 3.5 of the .NET Framework was released on 19 November 2007, but it is not included
with Windows Server 2008. As with .NET Framework 3.0, version 3.5 uses the CLR of version
2.0. In addition, it installs .NET Framework 2.0 SP1, .NET Framework 2.0 SP2 (with 3.5
SP1) and .NET Framework 3.0 SP1, which adds some methods and properties to the BCL
classes in version 2.0 which are required for version 3.5 features such as Language Integrated
Query (LINQ). These changes do not affect applications written for version 2.0, however.[19]
As with previous versions, a new .NET Compact Framework 3.5 was released in tandem with
this update in order to provide support for additional features on Windows Mobile and Windows
Embedded CE devices.

The source code of the Base Class Library in this version has been partially released (for
debugging reference only) under the Microsoft Reference Source License.[1]

[edit] Changes since version 3.0

• New language features in C# 3.0 and VB.NET 9.0 compiler


• Adds support for expression trees and lambda methods
• Extension methods
• Expression trees to represent high-level source code at runtime.[20]
• Anonymous types with static type inference
• Language Integrated Query (LINQ) along with its various providers
o LINQ to Objects
o LINQ to XML
o LINQ to SQL
• Paging support for ADO.NET
• ADO.NET synchronization API to synchronize local caches and server side datastores
• Asynchronous network I/O API[20]
• Peer-to-peer networking stack, including a managed PNRP resolver[21]
• Managed wrappers for Windows Management Instrumentation and Active Directory
APIs[22]
• Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and
also expose WF workflows as WCF services.[23] WCF services can be made stateful using
the WF persistence model.[20]
• Support for HTTP pipelining and syndication feeds.[23]
• ASP.NET AJAX is included
• New System.CodeDom namespace.

[edit] Service Pack 1

The .NET Framework 3.5 Service Pack 1 was released on August 11, 2008. This release adds
new functionality and provides performance improvements under certain conditions,[24]
especially with WPF where 20-45% improvements are expected. Two new data service
components have been added, the ADO.NET Entity Framework and ADO.NET Data Services.
Two new assemblies for web development, System.Web.Abstraction and System.Web.Routing,
have been added; these are used in the upcoming ASP.NET MVC Framework and, reportedly,
will be utilized in the future release of ASP.NET Forms applications. Service Pack 1 is included
with SQL Server 2008 and Visual Studio 2008 Service Pack 1.

There is also a new variant of the .NET Framework, called the ".NET Framework Client
Profile", which is 86% smaller than the full framework and only installs components relevant to
desktop applications.[25]
[edit] .NET Framework 4.0

This article or section contains information about scheduled or expected future


software.
The content may change as the software release approaches and more information becomes available.

Microsoft announced the .NET Framework 4.0 on September 29, 2008. While full details about
its feature set have yet to be released, some general information regarding the company's plans
have been made public. One focus of this release is to improve support for parallel computing,
which target multi-core or distributed systems.[26] To this end, they plan to include technologies
like PLINQ (Parallel LINQ),[27] a parallel implementation of the LINQ engine, and Task Parallel
Library, which exposes parallel constructs via method calls.[28] Microsoft has also stated that they
plan to support a subset of the .NET Framework and ASP.NET with the "Server Core" variant of
Windows Server 2008's successor.[29]

[edit] .NET vs. Java and Java EE


See also: Comparison of the Java and .NET platforms and Comparison of C# and Java

The CLI and .NET languages such as C# and VB have many similarities to Sun's JVM and Java.
They are strong competitors. Both are based on a virtual machine model that hides the details of
the computer hardware on which their programs run. Both use their own intermediate byte-code,
Microsoft calling theirs Common Intermediate Language (CIL; formerly MSIL) and Sun Java
bytecode. On .NET the byte-code is always compiled before execution, either Just In Time (JIT)
or in advance of execution using the ngen.exe utility. With Java the byte-code is either
interpreted, compiled in advance, or compiled JIT. Both provide extensive class libraries that
address many common programming requirements and address many security issues that are
present in other approaches. The namespaces provided in the .NET Framework closely resemble
the platform packages in the Java EE API Specification in style and invocation.

.NET in its complete form (Microsoft's implementation) is only available on Windows platforms
and partially available on Linux and Macintosh,[30][31][32] whereas Java is fully available on many
platforms.[33] From its beginning .NET has supported multiple programming languages and at its
core remains platform agnostic and standardized so that other vendors can implement it on other
platforms (although Microsoft's implementation only targets Windows, Windows CE, and Xbox
platforms). The Java platform was initially built to support only the Java language on many
operating system platforms under the slogan "Write once, run anywhere." Other programming
languages have been implemented on the Java Virtual Machine[34] but are less widely used (see
JVM languages).

Sun's reference implementation of Java (including the class library, the compiler, the virtual
machine, and the various tools associated with the Java Platform) is open source under the GNU
GPL license with Classpath exception.[35] The source code for the .NET framework base class
library is available under the Microsoft Reference License. [36] [37]
The third-party Mono Project, sponsored by Novell, has been developing an open source
implementation of the ECMA standards that define the .NET Framework, as well as most of the
other non-ECMA standardized libraries in Microsoft's .NET. The Mono implementation is meant
to run on Linux, Solaris, Mac OS X, BSD, HP-UX, and Windows platforms. Mono includes the
CLR, the class libraries, and compilers for C# and VB.NET. The current version supports all the
APIs in version 2.0 of Microsoft's .NET. Full support exists for C# 3.0 LINQ to Objects and
LINQ to Xml. [38]

[edit] Criticism
Some concerns and criticism relating to .NET include:

• Applications running in a managed environment tend to require more system resources


than similar applications that access machine resources more directly. Some applications,
however, have been shown to perform better in .NET than in their native version.[citation
needed]
This could be due to the runtime optimizations made possible by such an
environment, the use of relatively well-performing functions in the .NET framework,
just-in-time compilation of managed code, or other aspects of the CLR.[39][40]
• As JIT languages can be more easily reverse-engineered than native code to algorithms
used by an application there is concern over possible loss of trade secrets and the
bypassing of license control mechanisms. Many obfuscation techniques already
developed can help to prevent this; Microsoft's Visual Studio 2005 (and newer) includes
such a tool.
• In a managed environment the regularly occurring garbage collection for reclaiming
memory suspends execution of the application for an unpredictable lapse of time
(typically no more than a few milliseconds, but in memory-constrained systems can be
much longer). This makes such environments unsuitable for some applications such as
those that must respond to events with predictable timing (see real-time computing).
• Since the framework is not pre-installed on older versions of Windows an application that
requires it must verify that it is present, and if it is not, guide the user to install it. This
requirement may deter some from using the application.
• Newer versions of the framework (3.5 and up) are not pre-installed on any versions of the
Windows operating system. Some developers have expressed concerns about the large
size (around 54 MB for end-users with .NET 3.0 and 197 MB with .NET 3.5) and
reliability of .NET framework runtime installers for end-users. The first service pack for
version 3.5 mitigates this concern by offering a lighter-weight client-only subset of the
full .NET Framework.
• The .NET framework currently does not provide support for calling Streaming SIMD
Extensions (SSE) via managed code. However, Mono has provided support for SIMD
Extensions as of version 2.2 within the Mono.Simd namespace; it is hoped[who?] that this
SIMD support will be adopted by the CLR ECMA standard and Microsoft's CLR.
Streaming SIMD Extensions have been available in CPUs since the introduction of the
Pentium III.

[edit] Alternative implementations


The Microsoft .NET Framework is the predominant implementation of .NET technologies. Other
implementations for parts of the framework exist. Since the runtime engine is described by an
ECMA/ISO specification, other implementations of it are unencumbered by patent issues. It is
more difficult to develop alternatives to the base class library (BCL), which is not described by
an open standard, and may be subject to copyright restrictions. Additionally, parts of the BCL
have Windows-specific functionality and behavior, so implementation on non-Windows
platforms can be problematic.

Some alternative implementations of parts of the framework are listed here.

• Microsoft's Shared Source Common Language Infrastructure is a non-free shared source


implementation of the CLR component of the .NET Framework. However, the last
version only runs on Microsoft Windows XP SP2, and does not contain all features of
version 2.0 of the .NET Framework.
• Portable.NET (part of DotGNU) provides an implementation of the Common Language
Infrastructure (CLI), portions of the .NET Base Class Library (BCL), and a C# compiler.
It supports a variety of CPUs and operating systems.
• Microsoft's .NET Micro Framework is a .NET platform for extremely resource-
constrained devices. It includes a small version of the .NET CLR and supports
development in C# and debugging (in an emulator or on hardware), both using Microsoft
Visual Studio. It also features a subset of the .NET base class libraries (about 70 classes
with about 420 methods), a GUI framework loosely based on Windows Presentation
Foundation, and additional libraries specific to embedded applications.
• Mono is an implementation of the CLI and portions of the .NET Base Class Library
(BCL), and provides additional functionality. It is dual-licensed under free software and
proprietary software licenses. Mono is being developed by Novell, Inc. It includes
support for ASP.NET, ADO.NET, and evolving support for Windows Forms libraries. It
also includes a C# compiler, and a VB.NET compiler is in pre-beta form.
• CrossNet is an implementation of the CLI and portions of the .NET Base Class Library
(BCL). It is free software. It parses .NET assemblies and generates unmanaged C++ code
that can be compiled and linked within any ANSI C++ application on any platform.
• .NET for Symbian .NET Compact Framework implementation for Symbian (S60)
Comparison of the Java and .NET platforms
From Wikipedia, the free encyclopedia

Jump to: navigation, search


This article is written like a personal reflection or essay and may require cleanup. Please
help improve it by rewriting it in an encyclopedic style. (January 2008)

This is a comparison of Microsoft software development (.NET platform development) with the
other widely-used alternative platform, namely Java programming development which is largely
controlled by Sun Microsystems and used with modifications by IBM and Apple Mac.

Contents
[hide]

• 1 Legal issues
o 1.1 Standardization
o 1.2 License
 1.2.1 Java
 1.2.2 .NET
• 2 Community
• 3 Traditional computer applications
o 3.1 Desktop applications
o 3.2 Server applications
• 4 Embedded applications
o 4.1 Mobile applications
o 4.2 Leading edge technologies
• 5 Runtime inclusion in operating systems
o 5.1 .NET/Mono
o 5.2 Java
• 6 See also
• 7 References

• 8 External links

[edit] Legal issues


[edit] Standardization
The two platforms, their programming libraries, their binary formats, and their runtime
environments have largely been governed by very different means.

International standards organizations Ecma International and ISO/IEC define the standard for the
.NET executable environment (known as the Common Language Infrastructure, or CLI), and
.NET executable format (known as Common Intermediate Language, or CIL), but excluding
most of the foundation classes (the Base Class Library, or BCL). This formal committee-based
standardization process is in keeping with the way very popular languages like COBOL, Fortran
and C have been standardized in the past. The standards do not include many new libraries that
Microsoft has implemented on top of the standard framework, such as those for accessing
databases, or building GUI and Web applications, such as Windows Forms, ASP.NET and
ADO.NET.

To date, no part of Java has been standardized by Ecma International, ISO/IEC, ANSI, or any
other third-party standards organization. While Sun Microsystems has unlimited and exclusive
legal rights to modify and license its Java trademarks, Sun voluntarily participates in a process
called the Java Community Process (JCP) that allows interested parties to propose changes to
any of Sun's Java technologies (from language and tools to API) via forums, consultation
exercises and expert groups. The JCP requires a membership fee for commercial contributors,
while non-commercial contributors and individuals can join for free.

Within the rules of the JCP anyone can bring forward a proposal for a new Platform Edition
Specifications or suggest changes to the Java language. All proposals are reviewed and voted on
by interested JCP members at various stages throughout their lifecycle, however when it comes
to including changes into the standard reference implementations (Java SE, Java EE and Java
ME) modifications may be subject to rejection by Sun, who retain ultimate power of veto.

Java standards are maintained by a suite of test applications which examine every aspect of a
given Java implementation against a rigorous specification. Only if an implementation passes the
tens of thousands of individual tests can it use the trademarked name "Java", and associated
logos and brands.

[edit] License

[edit] Java

While "Java" is a Sun trademark, and only Sun can license the name "Java", numerous free
software projects exist that are compatible with Sun Java. Most notably, GNU Classpath and
GCJ provide a free software class library and a compiler that are partially compatible with the
current version of Sun Java.[1] Sun announced in November 13, 2006 that all Java source code,
excluding closed-source code for which they do not retain rights, will be released under a
modified version of the GPL,[2] and released two fundamental parts of the JRE and JDK: HotSpot
and the javac compiler under the GPL.[3][4]

Following their promise, Sun released the complete source code of the Class library under GPL
on May 8, 2007, except some limited parts that were licensed by Sun from 3rd parties who did
not want their code to be released under an open-source license[5] (see also Free Java
implementations). Sun's goal is to replace the parts that remain closed with alternative
implementations and make the class library completely open.

In June 2008, Red Hat announced[6] that the IcedTea project has passed the rigorous Java TCK,
indicating a fully functional open-source implementation of the Java platform.

[edit] .NET

Microsoft's .NET CLI executable environment, and some of the corresponding class library,
have been standardized and can be freely implemented without a license. Several standards-
compliant free software environments have been implemented, such as the Mono Project and
DotGNU. The Mono Project has also implemented many of Microsoft's non-standard libraries by
examining Microsoft materials, similar to GNU Classpath and Java.

Microsoft is currently distributing a shared source version of its .NET runtime environment for
academic use.[7]

The Mono project aims to avoid infringing on any patents or copyrights, and to the extent that
they are successful, the project can be safely distributed and used under the GPL. On November
2, 2006, Microsoft and Novell announced a joint agreement whereby Microsoft promised not to
sue Novell or its customers for patent infringement.[8] According to a statement on the blog of
Mono project leader Miguel de Icaza, this agreement only extends to Mono for Novell
developers and users.

The Microsoft/Novell agreement was criticized by some in the open source community because
it violates the principles of giving equal rights to all users of a particular program (see
Agreement with Microsoft and Mono and Microsoft’s patents).

In response to the Microsoft/Novell agreement the Free Software Foundation revised its GNU
General Public License to close the loophole used by Microsoft and Novell to bypass the GPL's
very restrictive provisions on patent deals.[9] The FSF also stated that by selling coupons for
Novell's Linux software, the mechanism by which Microsoft circumvented the GNU license, it
considers Microsoft to be a Linux vendor, and thereby subject to the full terms and conditions
laid out in the GPL.[9] (Microsoft issued the coupons because on the patent deal worked out
between the two companies Novell's network patents were considered far more profitable to
Microsoft than Microsoft's .NET patents were to Novell.)

[edit] Community
In its proprietorship of Java, Sun works with an open culture, allowing multiple parties, from
organizations to individuals, to steer the decision making process. Sun retains exclusive and
unlimited legal rights to its Java intellectual properties, and the Java community is subject to
those rights.
Sun's acceptance of third-party contributions goes to solve the problem of vendor lock-in at the
cost of sometimes creating a baffling array of options for beginners wishing to choose a Java-
based solution. Java has grown in popularity to become one of the most popular languages of the
early 21st century, and the pluralist nature of its development has resulted in many different
groups tackling the same (or similar) problems. This issue is particularly acute in the Enterprise
space (web/Ajax/Web2.0 applications), where one must not only be familiar with Java, but also
the various competing frameworks.

While Microsoft has developed C# and .NET without a formal community contribution system,
the language and some parts of the executable format and runtime have been standardized and
freely distributed through Ecma and the ISO in an open and vendor-neutral process, rather than a
process that retains veto and copy rights for Microsoft. However, the standards do not include
many new libraries that Microsoft has implemented on top of the standard framework (see
Standardization). Numerous C# and CLI community software projects, help and documentation
sites, and discussion forums are under active development and maintenance, including those
focusing on Windows development with Microsoft .NET or the Mono project, Free software
Operating system development under the Mono project, and mobile development using
Microsoft's .NET compact framework..

Microsoft is distributing a shared source release (version 1.0) of the .NET virtual machine that
can be compiled and used on Windows, FreeBSD, Mac OS X, and other platforms.[10] An
updated version (2.0) is currently available, but the only officially supported platform is
Windows.[11] A community port to Linux of the 1.0 shared source .NET virtual machine is also
available.[12] In March 2003, O'Reilly Media published a book about Microsoft's shared source
.NET runtime.[13]

[edit] Traditional computer applications


[edit] Desktop applications

Java has sometimes been accused of promising much and delivering little when it comes to
desktop applications.[citation needed] Although Java's AWT (Abstract Windowing Toolkit) and Swing
libraries are not shy of features, Java has struggled to establish a foothold in the desktop market.
Its rigid adherence to the notion of write once, run anywhere makes it difficult to use to the
maximum the unique features and modes of working within each individual desktop
environment. In the past, desktop applications written in Java have often been accused of looking
"alien" on any platform they are run on, although recent versions of Java have started allowing
greater use of native widgets.[14] Sun Microsystems has also been slow, in the eyes of some,[citation
needed]
to promote Java to developers and end users alike in a way which makes it an appealing
choice for desktop software. Even technologies such as Java Web Start, which have few parallels
within rival languages and platforms, have barely been promoted.

The release of Java version 6.0 in December 11, 2006, saw a renewed focus on the desktop
market with an extensive set of new tools for closer integration with the desktop. At the 2007
JavaOne conference Sun made further desktop related announcements, including a new language
aimed at taking on Adobe Flash (JavaFX), a new lightweight way of downloading the JRE which
sees the initial footprint reduced to under 2Mb, and a renewed focus on multimedia libraries.

An alternative to AWT and Swing is the Standard Widget Toolkit (SWT), which was originally
developed by IBM and now maintained by the Eclipse Foundation. It attempts to achieve
improved performance and visualization of Java desktop applications by relying on underlying
native libraries where possible.

.NET has become increasingly common in open source and free software systems due to its
inclusion[15] by the GNOME desktop environment using the Mono framework.

[edit] Server applications

This is probably the arena in which the two platforms are closest to being considered rivals. Java,
through its Java EE (aka Java Platform Enterprise Edition) platform, and .NET through
ASP.NET, compete to create web-based dynamic content and applications.

Both platforms are well used and supported in this market, with a bevy of tools and supporting
products available for Java EE and .NET. And both have high profile backers. For example, for
Java: Oracle included direct support for Java into its database, while Google has used Java to
power tools like Gmail.[16]

Some of Sun's current Java-related license agreements for Java EE define aspects of the Java
platform as a trade secret,[17] and prohibit the end user from contributing to a third-party Java
environment. Specifically, at least one current license for a Sun Java EE development package
contains the following terms: "You may make a single archival copy of Software, but otherwise
may not copy, modify, or distribute Software." — "Unless enforcement is prohibited by
applicable law, you may not decompile, or reverse engineer Software." — "You may not publish
or provide the results of any benchmark or comparison tests run on Software to any third party
without the prior written consent of Sun." — "Software is confidential and copyrighted."[17]
However, while Sun's software is subject to the above license terms, Sun's Java EE API
reference has been implemented under an open source license by the JOnAS project.

Microsoft's implementation of ASP.NET is not part of the standardized CLI, and while
Microsoft's runtime environment and development tools are not subject to comparable secrecy
agreements to Java EE, the official Microsoft tools are not open source or free software, and
require Windows servers. However, a cross-platform free software ASP.NET 1.1 implementation
is part of the Mono project.[18]

[edit] Embedded applications


[edit] Mobile applications

Java's Java ME (formerly J2ME) has a very large base within the mobile phone and PDA
markets, with only the cheapest devices now devoid of a KVM (a cut down Java Virtual
Machine for use on devices with limited processing power). Java software, including many
games, is commonplace.

While almost every mobile phone includes a JVM, these features are not always heavily used by
users (particularly in North America). Initially Java applications on most phones typically
consisted of menuing systems, small games, or systems to download ringtones etc. However,
more powerful phones are increasingly being sold with simple applications pre-loaded, such as
translation dictionaries, world clock displays (darkness/light, timezones, etc.) and calculators.
Some of these are written in Java, although how often phone owners actually use them is
probably unknown.

In January 2007 Steve Jobs suggested that Apple's iPhone would not support Java.[19][20]
Significantly, at that time Java's mobile platform was perceived as nearly ubiquitous across the
cell phone market, commonly being used by software companies to write device-neutral mobile
applications. Noted commentators argued against Jobs' stand,[21] but when the iPhone finally
appeared it did indeed lack both Java and Adobe's rival Flash technology, favoring instead
simple web applications using the phone's Safari browser.

In May 2007 Sun used the JavaOne conference to announce JavaFX Mobile, as a direct response
to Adobe's attempt to introduce Flash onto mobile devices.[citation needed]

In October 2007 Apple bowed to pressure and announced that by early 2008 the iPhone would be
opened up to allow development of software other than via the Safari browser.[citation needed]
Currently it does not look likely Java or Flash will be directly supported under this plan,
although a third party could port JavaME to the iPhone.

[edit] Leading edge technologies

Java has found a market in digital television, where it can be used to provide software which sits
alongside programming, or extends the capabilities of a given Set Top Box. TiVo, for example,
has a facility called "Home Media Engine", which allows JavaTV software to be transmitted to
an appropriate TiVo device to complement programming or provide extra functionality (for
example, personalized stock tickers on a business news program.)

A variant of Java has been accepted as the official software tool for use on the next generation
optical disc technology Blu-ray, via the BD-J interactive platform. This will mean that
interactive content, such as menus, games, downloadables, etc. on all Blu-ray optical discs will
be created under a variant of the Java platform. Blu-ray equipment first went on sale to the
consumer in 2006, and is currently not widely owned. However, the release of the Sony
Playstation 3 in late 2006 and early 2007 may give the platform a boost.

Rather than using Java, HD DVD (the defunct high definition successor to DVD) uses a
technology jointly developed by Microsoft and Disney called HDi that is based on XML, CSS,
JavaScript, and other technologies that are comparable to those used by standard web browsers.
The BD-J platform API is more extensive than its iHD rival, with an alleged 8,000 methods and
interfaces, as opposed to iHD's 400.[22] And while Microsoft is pushing iHD's XML presentation
layer by including it with Windows Vista, iHD is still a newcomer in a market sector where Java
technologies are already commonplace.[23]

However, the fact that the HD DVD format has been abandoned in favor of Blu-ray means that
HDi is no longer supported on any Optical disc format, making the BD-J format a clear winner.
[24]

[edit] Runtime inclusion in operating systems


[edit] .NET/Mono

On Windows, Microsoft is promoting .NET as its flagship development platform,[25] by including


the .NET runtime in Windows Server 2003 and Windows Vista, and distributing the Visual C#
Express development environment at no cost.[26]

.NET Framework 3.5 runtime is not pre-installed on versions of Windows prior to Vista SP1, and
must be downloaded by the user, which has been criticized because of its large size (65 MB
download for .NET 3.5).[27][28]

While neither .NET nor Mono are installed with Mac OS X out-of-the-box, the Mono project can
be downloaded and installed separately, for free, for any Mac user who wants to build and/or run
C# and .NET software (this excludes most of Windows GUI software though, because required
WinForms library is not included, neither is it compatible, with Mono implementation). As of 13
May 2008, Mono's System.Windows.Forms 2.0 is API complete (contains 100% of classes,
methods etc. in Microsoft's System.Windows.Forms 2.0); also System.Windows.Forms 2.0
works natively on Mac OS X.

C# and the CLI are included and used in a number of Linux and BSD based operating systems by
way of including the free software Mono Project.[29][30][31]

As a result of inclusion of .NET or Mono runtimes in the distributions of Windows and Linux,
non-GUI applications that utilize the programming interfaces that are common to both .NET and
Mono can be developed in C# or any other .NET language and then deployed across many
operating systems and processor architectures using a runtime environment that is available as a
part of the operating system's installation.[32][33][34] Both Microsoft .NET and the Mono project
have complete support for the Ecma- and ISO-standardized C# language and .NET runtime, and
many of Microsoft's non-standardized .NET programming interfaces have been implemented or
are under development in Mono,[35] but each environment includes many components that have
not been implemented in the other.

[edit] Java

Starting with XP SP1a, Windows does not ship with a Java runtime environment. However
according to a September 2003 press release some OEMs agreed to pre-install the JRE on their
desktop and laptop models. Mentioned were Acer, Dell, Gateway, Hewlett-Packard, and
Toshiba.[36] These companies combined make up a simple majority of consumer PC's sold in the
United States of America.[37]

Apple's support for Java means it has come pre-installed on all new Apple computers since the
launch of Mac OS X.

Java comes pre-installed with many commercial Unix flavors, including those from Sun, IBM
and Hewlett Packard.

Several Linux maintainers distribute non-free components including Sun Java in official archives
that are separated from their main operating system distribution, for example Debian non-free,[38]
Slackware extra,[39] OpenSuse non-OSS,[40] and Mandriva.[41]

The Operating System Distributor License for Java (DLJ)[42] is a Sun initiative to ease
distribution issues with operating systems based on OpenSolaris or Linux.

Free software operating systems were unable to include any Sun Java Runtime Environment.
However, in April 2008, the Fedora 9[43] and Ubuntu 8.04[44] distributions were released with
OpenJDK, based completely on free and open source code.[45]

Since June 2008, OpenJDK passes all of the compatibility tests in the Java SE 6 JCK and can
claim to be a fully compatible Java 6 implementation.[46][47] OpenJDK can run complex
applications such as Netbeans, Eclipse, Glassfish, or JBoss.

If Java is not installed on a computer by default, it may be downloaded by the user as a web
plugin. The web plugin process has been criticized because of the size of the Java plugin. Unlike
other plugins the Java download is a full runtime environment, capable of running not just
applets, but full applications and dynamic WebStart apps. Because of this the perceived
download footprint is larger than some web plugins. However, compared to Java, other popular
browser plugins have larger sizes: Java 6 JRE is 13 MB, but Acrobat Reader is 22 MB,
QuickTime 19 MB, Windows Media Player 13 MB, the .NET Framework 3.0 runtime is 54 MB,
and the .NET Framework 3.5 runtime is 197 MB.

At the JavaOne event in May 2007 Sun announced that the deployment issues with Java would
be solved in two major updates during the lifespan of Java 6 (the changes will not be held over to
Java 7.) These include:

• the introduction of a new consumer JRE edition, with an initial 2Mb footprint and the
ability to download the remaining 9Mb in sections using an on-demand methodology.
• the development of drop-in cross platform JavaScript code, which can be used from a
web page to install the necessary JRE for a given applet or Rich Internet Application to
run, if necessary.
• an improvement in support for automatically downloading updates to the JRE.
• support for pre-loading of the JRE, so applets and applications written in Java start up
almost instantaneously.

Potrebbero piacerti anche