SoFunction
Updated on 2025-03-01

Finally, I learned about the difference between .net and j2ee

Regarding .NET technology compared to Sun's Java2 Enterprise Edition (J2EETM), many customers want to understand Microsoft's perspective. .NET and JEE are a bit tricky for several reasons:

1)    Generally speaking, Windows .NET Framework is a carefully defined technical part of Microsoft’s Windows system, while J2EE is a written protocol. If it is not limited to academic discussions, in other words, the commercial value of this topic is discussed on several application platforms, then it is meaningless to just compare J2EE with a practical application tool.

Such practical application tools are: IBM's WebSphere application service, BEA's WebLogic service or other similar application services.

To get a satisfactory analysis, you can only compare products, such as comparing development efficiency. Using J2EE, developers need to create 4 components to build a single EJB. On the surface, this is just a little price to pay for development efficiency. However, some Java development tools hide some development skills and reduce efficiency. Another example is that the deployment system of J2EE is very complex and difficult to solve. The class is embedded in JAR, while the JAR is embedded in WAR, and the WAR is embedded in EAR. But to a certain extent, some tools can automatically complete the deployment process. The above situation leads to the key factors that determine the commercial value of an application service. Development efficiency varies from different sellers, which mainly depends on the efficiency of the development tool.

2) Question about "J2EE All-Star Team". This problem arises when comparing a collection of all components of .NET and J2EE. For example, analysts may encounter the following problems when considering development efficiency: Company A's products, Company B's application service programs, Company C's safety rules, Company D's easy installation, and Company E determines the price. All of this may be related to J2EE. Collecting the above characteristics, the J2EE tool looks good: cheap, easy to install, fast speed, high security, ultra-cache, good development tools, etc. But none of these matters—because it is impossible to obtain all of these traits at the same time. In fact, only one accurate feature can be obtained at a time. Because these products come from different companies, they cannot cooperate without interruption. For example, IBM's tools cannot work at the same time as BEA's WebLogic service, because the latter uses Oracle's cache engine, and Oracle's engine cannot be obtained at the price of Iona, etc. Sometimes people mistakenly regard "all features of J2EE" as the basis for comparison; but this is unreasonable. What customers need is to know one-to-one, product-to-product comparison.

3) It is very important to compare .NET and J2EE while ignoring other application platforms. J2EE is a specification that focuses only on application servers. But the vast majority of customers are interested in: application servers, ports, commercial servers and analytical tools, databases, separation of data and liquidity, information agents, application collections, capacity management, smart clients, and more. In response to customer requirements, these factors should work together and all major sellers should promote integrated platforms. For example, Microsoft's platform (including Windows system clients and servers, Windows .NET Framework, Visual Framework, and Microsoft enterprise server); BEA's WebLogic platform; IBM's WebSphere platform; Oracle's platform; and Sun's platform. Focusing on one of the problems (application servers) of these platforms will lead to a problem similar to the "woods and forests" relationship. Such an analogy is suitable, but it should be considered part of a wider platform.

From a Microsoft perspective, these are the key similarities and differences between Windows .NET Framework and J2EE-based products compared to those uncommon warnings.

Similarities

1) Windows .NET Framework and Java have a controlled runtime environment, which not only converts source code into intermediate languages, but also compiles these intermediate languages ​​to local executable code. Both environments support defragmentation, dynamic class loading, exception handling, etc.

2) Both .NET and Java advocate and support component-based design, polymorphism, inheritance and interfaces, etc., and also provide basic class libraries to perform I/O, XML processing, database access with connection pools, text operations and web scripting, etc.

3) Both are released through products from unique sellers. The J2EE specification itself is "sales neutral", but in fact, those products that comply with the specification must implement features outside the specification, such as management features or expansion features. Therefore, these products must be corresponding to specific sellers. For example, Microsoft's Windows and .NET systems.

4) Windows .NET Framework and J2EE-based products both work with third-party products. For example, in the field of back-end databases, .NET and J2EE-based applications can access data stored in Microsoft's SQL servers, IBM's DB2, Oracle, Informix, Sybase and other servers. To give another example, .NET and J2EE-based systems can access popular information intermediate devices, such as Microsoft's MSMQ or IBM's MQSeries. Similarly, it also includes file systems, third-party development tools, code version systems, firewalls, etc.

Differences

1) Principle

J2EE is a single language platform that focuses on cross-platform portability. This means that to use J2EE, the design scheme can use one of multiple operating systems, but developers must receive training on Java. Microsoft provides .NET architecture as part of Windows systems. Developers can use multiple languages ​​and are efficient without retraining a new language. But the .NET Framework is part of the Windows system.

2) Width and width

a. NET includes code, products, tools and architectures to utilize all computing resources on the network, including devices, personal computers, and servers. .NET enables all these devices to be connected together through standard communication protocols, which is the so-called "XML WEB service". (.NET applications can be connected to any system, no matter what language and platform the system uses, or even J2EE. As long as the target system complies with the XML WEB service standards.) The .NET model is a wide range of distributed computing, which communicates with many codes and exchanges information.

b. J2EE is a server-oriented model and does not develop intelligence and computing functions on the network. In general, J2EE-based products only support server-side applications. J2EE generally regards PC as an HTML browser, while these devices are considered dumb terminals. As for XML WEB service, the existing protocol standards support distributed computing. The existing version of J2EE specification does not mention the issue of XML WEB service, but J2EE-based products can also support XML Web services after adding additional devices. However, adding additional devices means strict restrictions. For example, it is not clear whether existing specifications allow EJB to call web services, although components of web services can call some EJB programs.

3) Consistency of programming models

Windows .NET Framework provides a consistent, component-oriented model across servers, PCs, and other devices. J2EE provides EJB as a server-side component model; establishes an open API written in Java for client or local components; provides servlets for user interfaces; and provides another different model for mobile devices. Even within EJB there are at least 3 obviously different submodels, each with a different language definition.

 

Microsoft's .NET programming model has better consistency on various servers and clients compared to Java platforms. J2SE is an open API written entirely in Java, while J2EE is based on Java servlets and EJB.

DH Brown, July 2002

 

4) Function

a.                                                                                                                              � Java and J2EE (existing) do not have a version-identified class loader, which means developers and administrators cannot guarantee that the code is executed correctly. Or in other words, developers can only rely on luck to ensure this.

b.                                                                                                                              � For example, using only one simple property in the source code can mark the .NET component as a processing mode. In other words, the serialization of a .NET component and XML can be defined in one property. This mechanism greatly simplifies many programming tasks. Java does not display class attributes on the language layer, although Sun considers that it needs to modify the Java language to change the status quo. This change is estimated to be realized for the first time within two or three years.

c. .NET also supports separate data access, which is mainly used for applications running on mobile devices or occasionally networked. The data can be operated offline and then resynchronized with the starting data. Neither J2EE nor J2SE support separate data access at this stage. J2EE developers who need this function must write "plumbing code" themselves.

d.         To build a network-based user interface, Windows .NET Framework provides event-based models that are similar to the smart client model in the popular Visual Basic. The ASP.NET model makes it easier to build, publish and maintain a web-based user interface. In contrast, J2EE does not support such a model in JSP. There are some third-party extensions that partially make up for these features, but their practicality and simplicity cannot be compared with ASP.NET. As a recommended J2EE add-on, Java Server Faces may do this. However, this additional program was not included before J2EE version 1.4. It will take at least one year to obtain the support of the seller.

e.          J2EE supports an object-related data image model, which is called EJB Entity Beans. This is to allow developers to more easily build object models from a related database. However, actually, programming this idea has to face the following problems:

Ⅰ. Ease of use: When those well-known, well-defined, widely supported structured query languages ​​(SQL) interact with developers' data, developers have to abandon them and use a weakly defined query language called EJBQL. Similar to SQL, EJBQL is not powerful (for example, in the existing specification, it does not have ORDER BY statements, so developers cannot use SQL extensions for specific databases), and its semantics are not properly defined. Also, it is very difficult to establish connections and affiliations between objects, and data translation between objects and XML and backends is manually controlled.

Ⅱ. Performance: The performance of EJB system is still an unknown number. No public benchmarks are provided. Customers reported that the resulting performance was far deviated from Entity Beans and turned to a more direct data access strategy. This is a key factor in the absence of EJB Entity Beans widely used.

In Windows .NET Framework, data access is based on dataset comparison. The dataset holds a subset of the relevant data, which is described by one or more SQL query statements. Data in the data set may hold critical connections, and developers can operate on the data directly, convert the data into XML format and the type of last operation, and use standard SQL to filter data, etc. In short, compared with EJB Entity Beans, the . NET dataset model provides a richer and simpler and more familiar way.

5) Simplicity

a. Configuration: For J2EE, configuration is an XML-formatted file obtained from deployment description information, and they are obviously different from the actual commercial logical code executed. There are many problems with this approach. First, considering the metadata of a specific class, changes in some code and changes in metadata are interdependent. There is a possibility that the synchronization requirement of two independent files can produce errors. Second, considering the metadata of the application layer, in J2EE, there is no way to inherit metadata from one program to another program. Unlike J2EE, Windows' .NET architecture includes this feature, allowing you to directly add properties to the class in the source code, so that the first problem will not arise. The metadata model in Windows.NET allows customers to add extensions themselves so developers can write and use their own properties. In order to configure external metadata in Windows' .NET architecture, this function is included in the hierarchical system of the configuration file, which can inherit attributes from the parent system, so that each file will be small and it only records the changed settings. This avoids the second problem of the J2EE model

b. Database connection pools In Windows.NET Framework, these pools are automatically established and managed as needed. In the J2EE model, connection pools must be explicitly configured and managed.

c. XML Web Service: Establishing an XML Web Service in .NET is as simple as adding a property to a class. Some J2EE-based products also want to simulate this feature in Java, and .NET provides a simpler way to establish and use XML Web services that can be operated by both parties.

d. Deployment: In .NET, to deploy an application, the administrator only needs to copy the files. In J2EE, administrators must bind many compiled files to JAR, WAR and EAR, then untie and run them in a specific server deployment tool, and then copy the result archive. This multi-step deployment process means that the typical edit/compile/debug loop is greatly extended. In addition, due to some changes in the dynamic loading of classes, updating a simple class often requires restarting a J2EE-based server.

 

Although many companies choose Java as a strategic platform for enterprise development, their use is hampered by the complexity of J2EE. Meta Group, August

 

6) Cost

a. For deployment, server-side applications written outside of the Windows .NET Framework require a Windows Server license, which is much cheaper than any of the three commercial servers that comply with J2EE. The system deployment cost difference between four network servers can reach hundreds of thousands of dollars. For example, the licensing fee for a four-machine system (each of four PCs) of Microsoft Windows Server 2003 (Enterprise Edition) does not exceed $16,000 (this takes into account retail factors). The license fee for WebSphere Application Server 5.0 in the same system is US$12,000, which is a total of US$192,000. This ratio is 12 to 1. Most J2EE-based commercial application servers are priced similarly. (This assumes equal performance. However, in fact, Middleware's October 2002 report shows that an application built on the Windows .NET Framework is 2-4 times more efficient than a program built on an equally popular J2EE-based server. So the price advantage is actually much higher than 12 to 1) There are many free, J2EE-based open source application servers, but they do not have the J2EE-compliant trademark. There are also questions about documents and products: Comparisons between products are needed to discuss licensing fees.

b. The cost of developing tools for Windows .NET Framework is also cheaper. Visual Studio .NET is an integrated development tool for .NET, and its licensing costs are much lower than the cost of development tools formulated by commercial J2EE sellers. And in the industry, Visual Studio .NET has won a series of awards as the best development tool. Customers who have evaluated Visual Studio .NET and its competitors say that Visual Studio .NET is more efficient in development compared to the best Java tools (See Giga, June 2002).

c. The development and maintenance costs of using Windows .NET Framework are lower. Experts believe that licensing costs are not the biggest expense of a project. Typical software development and maintenance account for 50-80% of the total project cost (Glass, 2002; Kemerer, 1995; Gartner, 2001). Middleware's October 2002 study showed that a given application development on the Windows .NET Framework only requires 1/3 of the code compared to J2EE. The less code, the easier it is to maintain.

Summarize

 

It is obvious: the right product choice decision cannot be made without evaluating the actual product. Comparing Microsoft Windows Server and Windows .NET Framework and J2EE (Sun’s specification) is valuable, but such efforts lack the evaluation of actual products. However, some conclusions can be drawn from it:

1) J2EE demonstrates a server-centric principle and focuses on EJB and solving "image problems for related objects". J2EE has lagged behind in supporting XML and Web services. The principle of Windows .NET Framework is to make large-scale distributed computing through protocol standards and XML, making full use of servers, interfaces and devices.

2)   Compared to programs written on the Windows .NET Framework, J2EE applications require more code to perform the same tasks.

3) J2EE's management and deployment model is more like a host model, which focuses on protecting and limiting rare computing resources and is used at a rate. The Windows .NET Framework demonstrates the principle that computing resources are cheap and will be cheaper, but deployment capabilities will maintain most of the expensive resources.

In short, if a project requires one of several operating systems to be selected as the deployment platform without considering development costs; forcing (and retraining and training) developers to execute the project using a single programming language, the version of the code is no longer important; what is important is to allocate and limit relatively cheap computing resources; so it is natural to use expensive and complex development and maintenance tools; and writing more code has its advantages - J2EE may be a good choice.

However, it is important if the business objectives show optimal development efficiency; low cost performance is more in line with the requirements; interoperability obtained through the standards of communication protocols is of high value; it is important to support a large number of interface-based applications and mobile applications; it is more interested in ease of extensibility—in this way, it is the right choice to build a Windows Server application on the Windows .NET Framework.