There is no doubt, programmer, software developer, and enterprise IT managers have always focused on the development of J2EE and .NET, but choose a platform that meets their needs in performance, price, and time is not a simple. thing. This article tries to make a simple comparison in technology, hoping to help them for choice.
I. Technical Overview
In the form of expression, J2EE is a set of specifications, and .net is more like a group of products. But their purpose is to provide distributed, highly reliable solutions for corporate applications. They have a lot of similarities on the architecture. The following table is a simple control:
J2EE .NET
Communication Protocol Remote Method Invocation over Internet InterNETOCOL (RMI / IIOP), XML
Programming language Java C #, VB.NET, COBOL
Runtime Environment Java Virtual Machine (JVM) Common Language Runtime (CLR)
Fat Client Java Swing Windows Forms
Directory Services Java Naming and Directory Interface (JNDI) Active Directory Services Interface (ADSI)
Data Access Java Database Connection (JDBC), Java Connectors ADO.NET
Asynchronous message Treatment Java Message Service (JMS) Microsoft Message Queue
Representation layer technology servlets, Java Server Page (JSP) ASP.NET
Intermediate layer assembly model EJB, JavaBean COM , COM
Safety access JaaS COM Security
Call context
Treatment Java Transaction Server (JTS) Microsoft Distributed Transaction Coordinator (MS-DTC)
Development Tool WebGain Visual Café
Borland JBuilder
IBM Visualage, etc.
(The third party is provided, the specification itself is not defined) Visual Studio.net
Composition of J2EE platform
EJB - J2EE intermediate layer, complete business logic;
JAAS - J2EE handles authentication and authorization API;
Java Connectors - J2EE is used to connect the API of the heterogeneous data source, which is transparent to the upper layer;
JSP, Java servlets - J2EE representation layer technology for generating user interface;
Java Virtual Machine - Java language operating environment;
JDBC - J2EE Database Access;
Asynchronous message queue from JMS - J2EE;
JNDI - J2EE's name Find API, independent of the directory server;
JTS - J2EE used to process the API of the transaction;
The communication API of the distributed object of RMI / IIOP - J2EE provides the ability to interact with CORBA.
.NET platform composition
.NET Framework - .NET App Railing Foundation;
IL (Intermediate Language) - All .NET languages are first compiled into this intermediate language and then run in the CLR;
SOAP - Industrial standards for service access;
DCOM - Component Communication Protocol;
MS-DTC - Used to use two phases on the .NET platform to handle distributed transactions;
CLR - .NET application runtime environment;
The intermediate layer model of COM - .NET is used to build business logic; ADO.NET - .NET - The API access to the data.
In addition .NET platform also includes a number of other products such as Application Center Server, BizTalk Server, NLBS (Network Load Balancing Service), Commerce Server, Enterprise Servers, HIS (Host Integration Server), ISAS (Internet Security and Acceleration Server) to provide as Firewall, security access, B2B transaction, load balancing and other services. J2ee specification It does not define these services, but you can meet similar requirements by selecting third-party products.
2. Technical comparison
1. More VS
A language VS variety of languages, a platform VS multiple platforms. This seems to be the topic of everyone who is the most happy to Zup, and it seems to be the focus of all problems.
Two platform mainstream development languages Java and C # have amazing similarity on the architecture: virtual machine technology, a sandbox security model, layered namespace, garbage collection, etc. So from the first eye, C # is simply Java cloning. But Microsoft does not think so, Microsoft's instructions are: "It integrates the essence of various languages such as C , Java, Modula 2, C and SmallTalk, and the DEEP Object-orientation, Object-simplification, etc., all made a reference. "On the one hand, most keywords from C # come from C , making it different from Java on writing. On the other hand, the concept of strict type conversion such as C # is obvious from Java (of course, its original type is more stringent, and according to Microsoft claims that there is no impact on efficiency.), Make it clone in connotation But is Java, and some of its characteristics are also quite a source of SmallTalk. So evaluating a development language is not only to see its external performance form, but more importantly, it is actually active. As a new language , C # joins the XML-based tag, can be used by the compiler to directly generate a document, another feature of C #: One-stop-shopping software emphasizes the coding method of self-description, ie Header file, Idl (Interface Definition Language), GUID, and other complex interfaces do not need to be referenced again. That is, C #, VB.NET and other codes can be arbitrarily added to other languages. This undoubtedly mix programming in multiple languages The pattern is a leap, but it is also self-evident.
Microsoft's .NET platform provides a variety of development languages such as C #, VB.NET, COBOL, C # is new, and every language is transformed on the original basis. This is Microsoft's painstaking It is also necessary to shop a convenient way for programmers who are accustomed to these languages. However, the transformation of these languages is that it is better to say that it is a big surgery that is open to the belly. The first is the concept change, Basic, COBOL Waiting for the language, the lack of object-oriented connotations, but now it has become an object-oriented language, which is not required to be familiar with some additional keywords. Based on object-oriented software analysis design and development The test is completely different from the quality of traditional procedural language, so the transformation of this process is also a painful and long process for traditional programmers. In front of traditional programmers, Microsoft seems to offer rich solutions. However, for practical problems, it is afraid that some power is not from the heart. So a simple way is: use C #. For independent software developers, its conversion cost cannot be ignored. Second, use multiple languages in a software project Developers must have a variety of language experts and multiple independent difficulty development groups, which is undoubtedly, which also increases the cost of maintenance of their software. Diversity is a double ten-du, time It is necessary to carefully apply. Cross-platform is the biggest selling point of J2EE, but also so far, it is also a fence of Microsoft. When the developer completes software that meets J2EE specifications, its customers can choose different application servers in accordance with their preferences and strength. From Based on Open Source's free software to high-end business kits to meet the B2B demand for commercial kits to build their own platform. But because J2EE's specifications are not perfect, the providers of each J2EE server have to add some of their own understanding. Additional features. This makes the application software for these special functions, binds to a specific application server. With the development of J2EE specifications, this difference will gradually decrease.
Microsoft's cross-platform solutions are Web Services, which solves connectivity issues between different applications on the heterogeneous platform. From a technical point of view, it doesn't have any new intentions except for XML. But it is important: It is launched by Microsoft's heavyweight players, the prospects are not small. The process of constructing and using Web Services is simpler:
Service providers use the language constructor he chosen;
Service providers define this service with WSDL (The Web Services Description Language);
The service provider is registered in UDDI (Universal Description, Discovery, and Integration);
The user's application finds the registered service from UDDI;
The user's application calls the service via SOAP (The Simple Object Access Protocol). (SOAP uses HTTP to pass the parameters based on XML-based expression)
As we discussed: Web Services is solved by the problem of service connectivity on the heterogeneous platform, but what is more urgent in reality, how to construct scalability, high reliability, high availability on the heterogeneous platform , Fault redundancy, erroneous recovery capabilities, is missing, from the structure, .NET platform is far away.
2. Intermediate layer
Component-based software development technologies can implement software multiplexing on a higher level, speed up the process of enterprise software development. In the J2EE architecture, JavaBean and EJB (Enterprise JavaBeans) are used to complete the logic. The EJB and JavaBean have similar Model, but it is used to create a distributed enterprise application. It defines the model of server-side components, with some of the following features:
Survival model;
Access model;
Safety model;
Life treatment model;
Session processing model;
Data package model; deployment model
According to these models, simple coding can complete complex functions.
In Microsoft's .NET platform, the old COM and COM components model are replaced by the new component model. Increased the functions such as the safety model and garbage collection of the sandbox. And realize multiple interface inheritance, extended metadata and new agent models. Old-raised COM and COM components can also be mapped to new operating environments .
In summary, the two architectures have a thousand autumn in the design of the component-based intermediate layer, which has sufficient ability to create distributed, complex, efficient, highly reliable applications.
3. Representation
Both architectures support the fat client and thin client. That is, C / S mode and B / S mode. For the C / S mode, J2EE provides Java Swing that replaces Java AWT, while JavaBean as a visual component can also be used Construction system. For the representation of the B / S structure, J2EE is implemented using a tool such as servlet, JAVA Server Page, HMTL, WML, XML.
Microsoft's fat client technology instead of MFC by Windows Forms. They have the same role, in structure Windows Forms being inserted into .NET's runtime framework (Component Model). In thin customers In the model, ASP.NET replaces the old ASP and HMTL, WML, XML as a representation layer. In ASP.NET, C #, VB.NET and other languages can be freely referenced. TheASP.NET page is first converted into an intermediary language, and then the compiler is compiled in the intermediary language (Just-in-Time) IL Compiler compiled, and finally runs in a public language operating environment, and ASP.NET provides buffering of the page, so its running speed is far from ASP.
In general, the technique of representing the representation used by the two architectures is very similar, although there is a greatest in detail, but the overall function is between Jiefang.
4. Data Access
J2EE and .NET have different forms of access to data. JDBC and ADO are not related to the connected database, and operate data by connection, command statements, and result sets. So, it belongs to the middle level API. Higher level data package and data management is through entity EJB (Entity EJB) ) Is done. Extract based on container management makes development faster, more convenient. In fact, due to the synchronization mechanism of the log EJB's LOAD () and STORE () method, it will greatly alleviate the bottleneck generated by concurrency It is also possible to use a third-party data access tool that is not a J2EE specification, like WebGain's Toplink.
Microsoft's .NET data access tools are replaced by XML-based ADO.NET instead of COM component-based ADO. Any data source output with XML can be used as an ADO.NET data source. The corresponding result set is upgraded to data Set (DataSet), the command statement is upgraded to the data set command (DataSetCommands). From the form, Microsoft's ADO.NET update tide and hipster, XML-based characteristics can handle extremely rich data sources, and because Its architecture is easy to penetrate on the HTTP protocol, making communication more convenient. However, due to the marked characteristics of XML itself, it is clearly limited to the use of large data and network bottlenecks. And J2EE The data access rule is slightly thin, but it is simpler, more efficient. And through the design of the application, access to the database and XML-based data source, is also seamlessly integrated.
3. Overall evaluation
When Microsoft is not enough to be relatively anti-based on the Java platform, Microsoft is happy to be loudly propaganda: "Write Once, Debug Everywhere". And its opponent is more pleasing to evaluate it: "Microsoft began to like Java, they liked it to let it die, they have hated it, they even hate everyone who starts with J." But now, form Different, Microsoft has enough. Net they can have a variety of comparisons for J2EE and .net themselves. The most lively should be a comprehensive comparison of the third part of Microsoft presence. Net PET SHOP and J2EE's PET Store's comprehensive comparison. Interested readers can see related comments from MSDN, www.onjava.com, IBM developers. . & bsp; J2EE .NET
Easy to use ** ***
Expansion Ability *** **
Multi-platform support **** *
Multi-language support * ****
Reliability *** ***
Performance *** ***
Manageable *** ***
Reuse **** **
Load balance *** ***
Open standard ***** *
In terms of enterprises, the integration of many systems, the system's ductility, security is a need for attention, and these are the advantages of J2EE, and it is also the shortcomings of Microsoft. In terms of efficiency, J2EE camp claims to compensate for the shortcomings of software through hardware. Open standards, powerful, easy to transplant, are J2EE's selling points. But it is strange that IBM's WebSphere and BEA WebLogic account for a large half of the wall of the J2EE market, but Sun as a rule maker is doing a wall.
Microsoft does provide a full range of products from the desktop office software, development tools, to the background server database. However, the user of the unified platform may sacrifice cross-platform, and it is possible to have an endless lock in the Wort Microsoft's license. It is simpler, faster, and more efficient to Microsoft's goal, with the times Development, we may see a more perfect technical solution.