Home > Articles > Programming > Java

📄 Contents

  1. J2EE Defined
  2. .NET Perspective
  3. Comparing the Technologies
  • Print
  • + Share This
From the author of

Comparing the Technologies

To compare the technologies, I've created the following table that compares J2EE/WebSphere with Windows DNA (VB/COM/ASP) and Microsoft.NET in a variety of categories. Note that not all technologies discussed in the J2EE column are mandated by the 1.2 specification, but WebSphere supports them in some way.

Table 1 Enterprise Technology Comparison

Technology

J2EE/WebSphere

Windows DNA

Microsoft.NET

Language and Runtime Support

Java. Developed in 1995 by Sun. All code is compiled into bytecode and interpreted by a virtual machine (JVM). May also be selectively JIT compiled, depending on the JVM, or fully natively compiled with ancillary products (such as JOVE). Can run on any platform that supports a JVM. IBM supports v1.3 of the J2SE SDK.

VBScript and JScript for Web pages and any COM-based language for server components (typically VB or VC++). Scripts are interpreted, while components are natively compiled. VB code also requires a runtime DLL (MSVBMxx.DLL). VBScript and JScript came into use in 1997, while COM grew out of OLE in 1993.

Any language that supports the Common Language Runtime (20-plus in development). Initially compiled to an intermediate language (MSIL) and then JIT compiled to native code by the CLR at runtime or natively compiled (PreJit) at install time. Code written for the CLR is referred to as managed code. Support for the CLR will be shipped with future OSes starting with Windows XP Server released by the end of 2001.

Class Libraries

Standard Java classes found in the J2SE, plus the APIs (JDBC, JSP, EJB, JMS, JAXP, JCA, JFC, JNDI, and so on, as defined in the J2EE specification). In addition, vendors include their own extensions to J2EE for integration and differentiation in the marketplace.

Win32, COM, MFC, ATL, and ASP. Five primary programming models that contain APIs that developers use in building solutions.

Services Framework. A hierarchical set of managed classes arranged in namespaces. Provides a consistent programming model and unifies the APIs needed to build solutions.

Deployment

Java Package. Collection of Java classes assembled as a unit and arranged hierarchically. Weak versioning. Server-based deployment uses XML-based deployment descriptors, which are read and handled differently by each vendor's implementation. WebSphere includes an application assembly tool to handle this process.

DLL, EXE. DLLs contain a collection of functions with weak versioning. EXEs represent an executable program with weak versioning. COM components are housed in DLLs, rely on the registry, and support immutable interfaces but no runtime version checking. Server-based installation accomplished through third-party utilities such as InstallShield.

Assembly. Unit of deployment, security, and versioning. Includes built-in PKI support and metadata to tightly control binding of assemblies at runtime. Support exists in the class loader of the CLR for consistency and version checking. Server-based deployment can be done in a no-impact fashion by simply copying the relative paths that contain the application. Applications also can explicitly share components. Support for the Windows Installer included in VS.NET.

Thin Client

Java Server Pages (JSP). WAS supports JavaScript or Java in JSPs that are compiled into HttpServlets on the fly and are cached by the server. No native support exists for different devices, and there are no client-state services other than cookies. WAS ships with an HTTP engine (1.3.19) but can use Apache, Domino, Netscape, iPlanet, or IIS 4.0/5.0. WAS 4.0 is v1.1–compliant. The syntax of JSPs is a knockoff of ASP and was developed in 1998.

Active Server Pages (ASP 2.0). Technology introduced by MSFT in 1997 in which pages containing server-side code are interpreted by an ISAPI server extension and can use simple HTTP caching through headers. No native support exists for different devices, and there are no client-state services other than cookies. ASP runs primarily on IIS 4.0/5.0 but has been ported to other platforms (see Chili!Soft, purchased by Sun). Performance of JSP and ASP is similar on similar hardware platforms.

ASP.NET. ASP.NET pages are compiled into MSIL either statically or on the fly when a request is made. Server control architecture allows abstraction for different devices and state storage across HTTP POST events. Server controls allow developers to create "adaptive controls" to render HTML, WML, and so on as appropriate for the client platform. Runs on IIS 4.0/5.0. Beta performance tests indicate a 200–300% improvement over JSP and ASP.

Web Server Processing

HttpServlets provide a request/response model available to Java classes in addition to session-state services keyed with a client cookie. JSPs often call servlets as the controller that acts as the broker between presentation and business service layers to provide separation between the HTML and Java code. Because of the complexity of writing servlets many "two-tier Web apps" simply have the servlets make direct calls to the underlying database via JDBC. This leads to spaghetti code that is difficult to debug and maintain. The servlet engine is included in WAS and includes a JDBC connection manager that handles database connection pooling. WAS 4.0 is v2.2–compliant.

The ASP runtime implemented in the ISAPI server extension provides a request/response model in addition to session- (keyed with a client cookie) and application-state services. ASP pages often call business services directly implemented as COM components, although many "two-tier Web apps" simply have the ASP pages make direct calls to the database via ADO. This leads to spaghetti code that is difficult to debug and maintain.

The HTTP Runtime in ASP.NET provides an extensible mechanism by which developers can hook into the processing of resources on the Web server through HTTP Modules. Provides very tight integration with the Web server. Also supports a request/response model and application- and session-state services. Session-state services can be deployed on a separate server to increase scalability. Provides a sophisticated caching mechanism for pages and programming code. Provides complete separation of HTML code and programming logic through code behind.

Object Services

Enterprise Java Beans (EJB). Part of the original J2EE specification in 1998. Java classes that are deployed in component-oriented middleware (a container) that provides interception and adds services such as distributed transactions (using the Java Transaction Service [JTS] based on the OMG and using IIOP), security, and database connectivity. The container can run on the same server or remotely. EJBs come in two flavors: entity beans and session beans. Entity beans map to the state of an object as represented by a row in a database. Entity beans provide the mapping to the database and caching of the entity. Entity beans come in two styles: Container Managed Persistence (CMP) and Bean Managed Persistence (BMP). CMP beans allow the container to manage loading and saving the database information, whereas BMP beans provide methods for the developer to insert JDBC code directly. Session beans come in two flavors: stateful and stateless. Stateful beans maintain a conversation with a single client, whereas stateless beans can be reused by multiple clients, with the container handling the allocation. WAS 4.0 is EJB 1.1–compliant.

Microsoft Transaction Server (MTS). Provides component-oriented middleware for COM components introduced in 1996. Provides interception and adds distributed transactions through the Microsoft Distributed Transaction Coordinator service (MSDTC), security, and object activation support. Objects can be both stateful and stateless, depending on administrative settings. Programmers take advantage of MTS services through the use of an API. Only components built in VC++ are free-threaded and thus perform better. No support for automatically mapping database rows to object instances exists.

Component Services (COM+ 1.0). Released with Windows 2000 in 2000 and provides component-oriented middleware for COM components. Provides interception and adds distributed transactions, security, object construction, object pooling, queued components (for asynchronous integration with MSMQ), loosely coupled events for publishing and subscribing to components, and activation support. Objects can be both stateful and stateless, depending on administrative settings. Although built for COM, .NET programmers create serviced components in .NET by deriving their class from a system class and decorate it with attributes to describe the services that it uses. The system class then communicates with COM+ via Win32 and COM APIs. No support for automatically mapping database rows to object instances exists. (The IMDB product that was removed from prerelease versions of COM+ would have served a similar purpose as entity beans, although the ADO.NET DataSet object serves a similar purpose.)

Database Support

JDBC. Data Access API that allows SQL access to a tabular data source via drivers (there are currently 159 listed on Sun's site under 4 different types, ranging from JDBC to ODBC bridges to fully native-protocol Java implementations). Various drivers support connection pooling, distributed transactions, and rowsets, and some are J2EE-certified. The API is similar to the Win32 implementation of ODBC. JDBC 2.0 is the spec under J2EE 1.2, but 3.0 has been defined. Note that when using entity beans with CMP, the container provides the mapping to the database tables through a vendor-specific mechanism. WAS 4.0 supports JDBC core v2.1 and Extensions 2.0. WAS includes providers for DB2, MSSQL, Oracle, Informix, and Sybase.

ADO/OLE DB. OLE DB is both a specification for COM interfaces that database vendors implement (OLE Providers) and a set of services (such as cursor processing and connection pooling) implemented in Windows to provide data access to a variety of data sources. ADO is a simplified automation layer that sits on top of OLE DB to provide data access to scripting languages and COM-based languages such as VB. Although typically used for tabular data access, both ADO and OLE DB can be used to access nonstructured data such as email and XML. OLE DB also can be used to access data through the plethora of available ODBC drivers.

ADO.NET. A set of managed classes that provides access to data sources through what are called managed providers. These include TDS (SQL Server), OLE DB providers, and ODBC drivers. Each managed provider implements connections and connection pooling, commands/parameters, forward-only cursor processing, transaction processing, and error handling. ADO.NET also includes a middle-tier data cache object called a DataSet that provides an XML-based cache of data that can be used to bind to controls and synchronize changes to a data source through an adapter object implemented by the managed provider. Designed to support a loosely connected model with built-in XML representation of the data and XSD representation of the schema. Developers can work with relational data as XML data, and vice versa through the XMLDataDocument class.

Messaging

Java Messaging Services (JMS). JMS is a set of client interfaces to message-oriented middleware (MOM) products that supports both message queues and publish-and-subscribe metaphors. MOM vendors implement JMS providers. JMS includes a specification for a new type of EJB, message beans. WAS includes the (WebSphere MQ) MQSeries JMS provider. WAS 4.0 is compliant with the 1.0.2 specification and includes support for JMS-XA distributed transactions across MQSeries-enabled systems and databases. Need to obtain WebSphere MQ separately.

Microsoft Message Queue Server (MSMQ). A MOM server product running on NT 4 and W2K that supports message queues but does not include a publish-and-subscribe feature built into the product. The product includes a COM-based API for sending and receiving messages and administering queues. Supports distributed transactions through MSDTC. MSMQ is built into Windows NT 4.0 Server.

System.Messaging. A set of managed classes that provide the administrative and client APIs for working with MSMQ servers. MSMQ is built into Windows 2000 Server. It should be noted that developers can access MSMQ through queued components (QC) supported by COM+ 1.0. QC acts as an abstraction layer to allow clients to asynchronously make method calls on components that are backed by MSMQ.

Fat Client

Java Foundation Classes (JFC). JFC includes the Abstract Windowing Toolkit (AWT) and Swing as Java APIs for building GUII applications. Swing is a more abstract API and includes a "look and feel" for developing the same GUI on multiple platforms or adhering to a platform standard. Advanced graphics can be created with the Java2D and 3D APIs. GUI apps run as standalone applications or applets running in a browser.

Win32/ActiveX. Applications written in VB, VC++, or other Windows development tools. Ultimately these tools make calls to the Win32 API for the underlying window management. ActiveX is a COM-based technology for building reusable binary visual components (.ocx) across development environments. Applications run as standalone applications or as ActiveX controls hosted in MSIE. Advanced graphics are available through the DirectX set of COM-based APIs.

Windows Forms. Set of managed classes that allow for the creation of forms-based applications. Takes advantage of new Windows 2000 features such as nonrectangular forms. Includes a managed control architecture to build reusable visual controls. Third parties will provide wrappers for DirectX functionality. Windows Forms–based applications can run as standalone applications or can be hosted in MSIE on clients with the CLR installed.

Integration

J2EE Connector (JCA). JCA is a specification based on the IBM Common Connector Framework (CCF). WAS contains WAS adapters used to connect to packaged applications such as JDEdwards, SAP, Peoplesoft, and so on. These are JCA-compliant and are shipped with VisualAge for Java. You can also build new adapters using the MQSeries adapter offerings. WAS AE multiserver version only.

SNA Server 4.0. Server product that includes OLE DB and ODBC support for AS/400 and DB2. Also includes COM Transaction Integrator (COMTI) for working with CICS and IMS transactions as if they were COM objects. Includes MSMQ-MQSeries bridge and host printing services, among others. Basically, this is COM-based integration, and there are also connectors to packaged products such as the SAP DCOM Connector.

Host Integration Server 2000. Update of SNA Server. Also includes integration with Commerce Server, BizTalk, Active Directory, and Windows Management Instrumentation (WMI). BizTalk also supports application-integration components (AIC) that can be built to integrate with packaged applications; for example, there is a SAP R/3 AIC available.

XML Support

Java API for XML Parsing (JAXP). An API and abstraction layer to deal with various XML parsers. Not included in the J2EE 1.2, but 1.0 is in 1.3. v1.1 supports XSLT and DOM Level 2 and SAX v2.0. IBM has a 100% Java validating XML parser with JAXP support available on its Web site. WAS includes support for DOM 1.0, SAX 1.0, and XSLT 1.0.

MSXML. Microsoft's COM-based XML parser, included as a standalone addition to the OS and in products such as MSIE. Version 3.0 sp1 is the current version, with v4.0 as a technology preview on the MSDN Web site. V3.0 supports XSLT, XPath, and SAX2. Implements much of the DOM functionality specified by the WS3C, in addition to SAX support for event-based processing of large XML documents.

System.Xml. A set of managed classes that implement the DOM, XSLT, and XPath specifications by the W3C. Supports both a tree-based model (DOM) and an innovative stream-based approach for parsing XML documents. Also contains a class that maps XML documents to the ADO.NET DataSet class to provide XML-based access to relational data.

Web Services

WAS ships with the Apache SOAP 2.2 tool support. The toolkit is SOAP 1.1–compliant. Can expose Java classes, EJBs, BSF scripts, or DB2-stored procs as a Web Service. Includes a command-line utility to publish EJBs as SOAP services. Development tools contain wizards to create WSDL from an existing Java application or read WSDL to create a server stub or client proxy. UUDI4J support is also included for client-side interaction with UDDI registries.

SOAP Toolkit 2.0. Downloadable. Current release is sp2. Provides a COM wrapper for implementing Web Services. Wizard exposes COM objects as a Web Service using ASP or IIS ISAPI extensions. Support for WSDL 1.1. A separate UDDI SDK is available for download, and provides a COM API for building and querying a UDDI registry. The toolkit integrates into VS 6.0 so that creating Web Services from COM components is straightforward.

.NET Framework. SOAP 1.1 is implemented in a variety of the base class libraries and, therefore, is very tightly integrated from both consumer and implementer perspectives. Allows individual methods in managed classes to be exposed as Web Services through an attribute of the framework. Automatic creation of WSDL from XSD schemas and managed classes. Automatic creation of managed client proxies from WSDL through the command line and UI in VS.NET with full Intellisense. A separate UDDI SDK is available for download that provides managed classes for building and querying a UDDI registry.

Remoting

Remote Method Invocation (RMI)-Internet InterORB Protocol (IIOP). Provides the programming model (RMI) and the protocol layer for (CORBA IIOP) Java-to-Java communication. Servlets and applets communicate with EJBs via RMI. Assumes a tightly bound model that creates firewall issues and is not well suited to the Internet.

DCOM. Extension of COM for component communication across the network using any of the Windows NT network protocols. Includes remote activation and security features. Remoting of object instances must be specifically programmed into the COM objects themselves. Assumes a tightly bound model that creates firewall issues and is not well suited to the Internet.

.NET Remoting. Implemented in a set of managed classes. Allows managed code to communicate across app domain boundaries. Can communicate via HTTP or TCP channels. Supports remoting of object instances via binary or SOAP protocols. Supports singletons and client activation. The use of HTTP and SOAP promotes a loosely coupled architecture that does not incur firewall problems.

Naming Services

Java Naming and Directory Interface (JNDI). Programming interface that provides access to directory services such as DNS, LDAP, Novell (NDS), and CORBA COS through vendor-specific providers.

WAS 4.0 is JNDI 1.2–compliant for EJB lookup. The IBM SecureWay Directory 3.2.1 product is included in WAS for access to Active Directory, Lotus Domino, and NDS.

Active Directory Services Interface (ADSI). COM programming interface that supports access to NT, LDAP, and Novell (NDS) directory services through vendor-specific providers.

Active Directory and System.DirectoryServices namespace. Windows 2000 Server includes the distributed directory used in a Windows 2000 domain while the managed classes, in DirectoryServices provide a wrapper around the ADSI interfaces to programmatically access a directory.

Development Tools

WebSphere Studio, Visual Age for Java. Both ship with WAS. Studio is used to build the visual representation of Web pages and JSPs, while Visual Age is used for Java coding of servlets, beans, and EJBs.

Visual Studio 6.0, released in 1998 (three IDEs). Separate IDEs exist for VC++/Visual Interdev for ASP development, and VB for form and component development. Graphical Web development.

Visual Studio.NET. Single IDE that supports unified debugging, project management, Intellisense, Server Explorer, graphical editor for the Web and forms, class view, dynamic help, add-ins, and scripting. Can be used to build console applications, Windows Forms, Web Forms, Web Services, Windows Services, and components. Third-party compiler vendors can plug into VS.NET.

B2B Integration

ebXML. An industry specification (not a shipping product) for performing business-to-business transactions using XML and the Web. Includes some support for SOAP. Not implemented in WAS. Would need to roll your own infrastructure perhaps using Web Services.

No support on NT 4. Would need to roll your own infrastructure using the SOAP Toolkit and Windows services.

BizTalk Server 2000, released in 2000. A separate server product that provides a messaging/scheduling engine and business process orchestration facilities. Messaging includes support for EDI, SOAP, and Rosettanet grammars, in addition to others.

Key Strengths

For organizations that must have platform neutrality, J2EE is the only alternative. The Java language is becoming more widely accepted. Vendors such as IBM offer a single-vendor solution when dealing with legacy applications. Separation of application logic and presentation exists, although, in practice, this is underutilized. EJB model includes automatic database-mapping facilities through CMP.

Large base of VB/ASP developers, resulting in reduced costs. Runs on commodity servers that can be scaled out. Software costs are low. Multiple language support through COM. Tight integration with the dominant client platform (Windows).

Multiple languages supported with a common set of class libraries. Unified programming model with the Services Framework. High productivity development environment. Web application performance. Runs on commodity servers that can be scaled out. Separation of application logic and presentation exists. Greater integration with XML and Web Services protocols. Tight integration with the dominant client platform (Windows).

Key Weakness

Single-language solution. Smaller base of developers. EJBs are complex and not widely used. Thus, JSPs are overused, resulting in spaghetti code. Varying levels of J2EE conformance across vendors. The need to use vendor-specific features leads to vendor lock-in. Performance varies due to vendor-specific implementations. Software cost is generally higher, developer costs are higher, and deployment time is increased.

Highly fragmented programming model. COM infrastructure is unwieldy, leading to DLL hell and versioning problems. ASP pages that do not utilize COM for business and data-access services lead to spaghetti code. Single-vendor solution.

Not a shipping product. OO nature of CLR makes development initially more complicated for VB/ASP developers. Single-vendor solution. Does not support an automatic mapping of database rows to objects as with CMP, although there is widespread disagreement within the industry as to whether entity beans are desirable because they do not promote transactional consistency and are questionable in terms of performance. For more information, see Roger Session's Web site.


You can also compare the J2EE architecture with .NET using Figures 1 and 2.

Figure 1 J2EE architecture.

Figure 2 .NET architecture.

  • + Share This
  • 🔖 Save To Your Account