.NET Framework For Java Programmers ---1(Good)

来源:互联网 发布:荣誉证书制作软件 编辑:程序博客网 时间:2024/06/05 04:10
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
.NET Framework For Java Programmers
Author: Ashish Banerjee

Objective

After reading this article Java programmers should be able to decipher and de-jargonize the .NET architecture and relate it with the proposed ECMA standard.
  

Target Audience

Java programmers and system architects.

Summary

This article outlines Microsoft's proposed standardization of .NET Framework in ECMA Forum as CLI (Common Language Infrastructure), but the Microsoft documentation refer this as CLR (Common Language Runtime). The CLR and JVM are compared with respect to market Forces which shaped the CLR definition. Components of CLR are examined followed by details of Microsoft's implementation of the CLR as the .NET Framework.
All along .NET Framework is compared with Java architecture.
The material is derived from author's own experience with Java since early 1996, Microsoft's MSDN site and standard documents from sites like ECMA and W3C.org.

Overview

.NET Framework is the Microsoft's answer to Java commune's objections to  /"Windonization/" of Java.
Microsoft introduces a new language C#, designed by the Visual J++ team. But in the process it has done away with DCOM and also have changed it's flagship language Visual Basic.
In a nutshell, .NET constitutes presently of three compiled languages C#, VB.NET and C++, a Java like runtime virtual machine environment, five execution containers hosting this runtime, namely: ASP.NET, Windows Shell, VBA scripting host For Office suite, Visual Forms container and IE (InterNET Explorer). Much like Java it contains a rich set of API and lib.
Enhancements over Java Framework include use of SOAP (Simple Object Access Protocol) For remoting. Version and security scoping using concept of Application Assembly (described later). A Common Type System is introduced For making mixed language programming easier. For example a VB component can inherit from a C# class.
In longer term Java and .NET will converge and thereFore an overview of the new Framework is presented here from Java programmer's perspective.

Comparing  CLR with JVM

The .NET Framework's Common Language Runtime (CLR) is much similar to Java Virtual Machine (JVM), in terms of garbage collection, security, just in time compilation (JIT).
However, the fundamental difference arises from the variance in perception of the Sun's Java design team headed by James Gosling and that of Microsoft's C# designers spear headed by Anders Hejlsberg
Sun viewed the InterNET as an heterogeneous NETwork consisting of multiple operating systems. Thus Sun had to design the GUI as the least common factor, supportable by all such platForm. This was also the major reason of Java's failure in client side applications. Java has been successful only on server side where there is no great need For GUI.
Having failed at client side desktop application arena, Sun is now targeting Java to server side applications market, which is dominated by Unix and Linux flavors having approximately 60% of the server market, the rest 40% rests with Windows NT.
But this view was not conducive to Microsoft, which holds about 90% of client side desktop market. Microsoft wanted to provide a window centric InterNET development platForm. Thus it added a few Window specific features in it's Java implementation, similar to what it had had done with it's C++ implementation. This along with Microsoft's refusal to support Java RMI, which competed with it floundering remoting technology called DCOM, resulted a law suite. Microsoft lost the law suite in late 2000, and had to pay USD 20 million  to Sun as settlement amount. This antagonist attitude made Microsoft break away from Java and float it's own language called C#.
The C# team was carved out of the Microsoft J++ team, and it's efFort finally led to the creation of .NET Framework.
Microsoft intends to leverage it's desktop leadership, to shape the InterNET applications development by introducing the .NET Framework. Thus the supported languages map the Windows GUI more closely in it's Framework, much similar to C++ MFC and J++ WFC (Windows Foundation Classes). In spite of the platForm independence design claims, all the three supported languages produce windows .exe code by default.
Microsoft played the standardization game better than Sun. Microsoft, though being an USA based company proposed the C# and Common Language Infrastructure (CLI), the back bone of .NET Framework, For standardization with ECMA (European Computer Manufacturing Association) TC39 Technical Committee in October 2000. Ironically Sun also happens to be a member of this standing committee, which looks after computer languages related standardization issues. See http://www.ecma.ch.
Microsoft has also successfully standardized Simple Object Access protocol (SOAP) through W3C (http://www.w3c.org). SOAP is a XML and HTTP based remote object access protocol. SOAP competes with Java's RMI and Microsoft's own DCOM. RMI has the limitation of being  language specific, and DCOM had limited acceptability outside the Windows community, this was, despite the best of Microsoft's efFort to port DCOM on Unix platForms.
CORBA, another remoting contender, which even has interNET specific transport namely IIOP, is more or less dead, due to it's vendor non interoperability.
SOAP, by virtue of HTTP transport can operate easily over firewalls and  thereFore can easily transident LAN and InterNET. However, SOAP being XML based,  burdens both client and server For XML parsing, which is relatively CPU intensive, compared to binary protocols like RMI and DCOM.
Java platForm views the InterNET  world as one language running on different operating systems (OS), whereas .NET Framework views the world running on one OS with a programmers having choice of  multiple languages. ThereFore Java platForm interpolates multiple operating systems, and .NET Framework interpolates multiple languages.
Apparently from the above discussion, the market Forces are largely responsible For the state-of-the-art rather than technical design considerations.

Inside The Common Language Runtime

The Common Language Runtime (CLR), is the runtime environment of the .NET Framework, which manages the execution of code and provides services.
The Common Language Runtime (CLR), is also proposed For ECMA standard. However, The ECMA documents refer the CLR as  Common Language Infrastructure (CLI). It has five components namely:
   CTS - Common Type System CLS - Common Language Specification CIL - Common Intermediate Language JIT   -  Just in Time Compiler VES - Virtual Execution System

CLI - Common Language Infrastructure

The Common Language Infrastructure (CLI) provides a language neutral platForm For application development and deployment. CLI supports both Object Oriented Paradigm (OOP) as well as hooks For modeling procedural and structured languages.
CLI provides languages with a Framework For security, garbage collection, exception handling and also provides a platForm For language interoperability. For example C# objects can inherit from C++ classes and VB procedures can use the C# components.
Please Note that the Microsoft documentations refer CLI as CLR (Common Language Runtime).
After reading through the ECMA standard documents, like me, you will probably develop the feeling that CLI is an attempt to standardize the next generation Java Framework For accommodating the older pre InterNET era languages like VB and C++.
The five components of the CLI is briefly described below.

CTS - Common Type System

The Common Type System, support both Object Oriented Programming like Java as well as Procedural languages like 'C'. It deals with two kinds of entities: Objects and Values. Values are the familiar atomic types like integers and chars. Objects are self defining entities containing both methods and variables.
Objects and Values can be categorized into the following hierarchy:
Types can be of two kinds Value Types and Reference Types. Value Types can further categorized into built-in (For example Integer Types and Float Type) and user defined types like Enum.
Reference Type can be divided into three sub categories: Self Describing Reference Type, Pointers and Interfaces. Pointers can be sub divided into Function pointers, Managed and Unmanaged Types.
Value Types can be converted into Reference Type, and this conversion is called Boxing of Values. De-referencing the Boxed Value Types from the Referenced Type is called Un-Boxing.
Casting rules from one type to another, For example conversion of char to integer types are also defined within the Common Type System.
Common Type System also defines scope and assemblies.  An assembly is a configured set of loadable code modules and other resources that together implement a unit of functionality. A scope is a collection of grouped names of different kinds of  values or reference types.
&n
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击