发表于2004/10/16 19:27:00 1180人阅读
.NET and J2EE Battle for the Enterprise
Peter O'Kelly （来自中国系统分析员） 2003年03月01日
Keeping track of the ongoing rivalry between Microsoft and Sun Microsystems as they seek to control the enterprise application development market can puzzle even the most dedicated developer. For the software architect, the competing "standards" can be bewildering. Yet would you believe that today's choices actually make it a relatively easier time for enterprise developers, compared to the previous generations of tools?
Microsoft and Sun share compelling visions for a new enterprise architecture, and each vision features strong interoperability through Web services and various standards.
It's certainly easier to deal with the .NET Framework and the Java 2 Platform Enterprise Edition (J2EE) now rather than handle five or ten largely incompatible visions, which is where the middleware industry was headed previously.
One of the most widely debated questions in the industry today is whether to choose Microsoft .NET or J2EE. From an enterprise architectural planning perspective, .NET and J2EE have a great deal in common and developer skills transfer nicely between them. J2EE products from vendors such as BEA, IBM, Macromedia, Oracle, and Sun have matured to the point where it's necessary for enterprise architects to place bets on either .NET or J2EE or both; the vast majority will place bets on both. For these reasons, think of .NET and J2EE as complementary, not competitive.
It's not surprising that the J2EE/.NET domain has been controversial and confusing. To begin with, both represent the culmination of decades of software evolution. For instance, Sun's J2EE 1.3 tutorial weighs in at more than 700 pages, and there are many books on J2EE and .NET that tip the scale at more than 1,300 pages. Such heft is not surprising, given that these documents attempt to address almost the entire computing spectrum, from enterprise middleware to handheld devices.
J2EE and .NET are also dynamic and fast-moving projects, each building on a large number of standards initiatives, especially for XML and Web services. As these standards are thrown together with the usual software industry marketing and propaganda, J2EE/.NET competition is so intense that it's often difficult to remember what the software market was like before they arrived. (Anyone embarking on a career in IBM's CICS or BEA's Tuxedo these days?)
Clear Up the Terminology
The inconsistent use of terminology has complicated the understanding of similarities and differences between the two models. Terms such as objects, components, and services are used in both models, for example, but often with subtly different meanings. It doesn't help that the press and industry analysts often compare specifications with product releases, and are imprecise about what's included in current releases versus what's planned for the future.
Even the scope of the competitive offerings is confusing. For example, J2EE products often include integration and portal services, while .NET is generally used as a blanket term to describe all future Microsoft software and services. Standing back from the hype and dynamic definitions, however, it's possible to discern many ways in which J2EE and .NET are converging toward a common enterprise architecture model.
At the core of an enterprise application, there's almost always a database management system (DBMS), transaction processing (TP) monitor, and message-oriented middleware (MOM) service included, such as IBM WebSphere MQ, Microsoft Message Queuing (MSMQ), or TIBCO. Indeed, in most enterprise contexts there are usually multiple instances of each, although they're increasingly morphing into platform services instead of distinct server product categories—a trend accelerated by the advent of Web application servers.
In the J2EE/.NET model, both the underlying DBMS/TP/MOM services and the business application contexts are managed at an object-oriented (OO) level of abstraction. The J2EE/.NET model brings the OO approach to mainstream enterprise computing, with powerful OO frameworks (class libraries) for services such as object persistence, transactions, Web services, and more. This model greatly extends the scope of work that can be done declaratively (with little or no procedural coding), and often includes a page/form/layout-driven drag-and-drop approach for application development.
Components are a key part of the J2EE/.NET model; think of them as collections of objects packaged and deployed together for simplicity, reusability, and flexibility. On the Java side, think "component" whenever you see "bean." .NET Enterprise Services and J2EE's Enterprise JavaBean (EJB) features are especially powerful for enterprise components, offering object and connection pooling and robust load balancing services.
UML-based tools are often used for J2EE/.NET application analysis and design, both because UML's object orientation is ideal for the J2EE/.NET implementation model and because of the expanding scope and complexity of today's enterprise endeavors. Although the approaches diverge at the coding/implementation phase, a common set of analysis and design techniques applies to both J2EE and .NET.
The use of a virtual machine (VM) architecture is also common to J2EE and .NET. Application development tools—such as Borland JBuilder, Sun Forte for Java, and Microsoft Visual Studio .NET—produce intermediate-level code instead of platform-specific binary code, which means the VM interprets that code in real time or performs Just-In-Time (JIT) compilation; the Microsoft VM always runs JIT-compiled code. This VM-based model results in platform-independent applications and is conducive to the late-binding technique that's critical to the OO approach.
J2EE and .NET share an asynchronous, loosely coupled, service-centric communication model, with application flow of control determined by messages among objects instead of sequential flow within monolithic programs. The newer model is more appropriate for the inherently object-oriented natures of J2EE and .NET, but it leads to a potentially steep learning curve for developers who are accustomed to the more traditional program-flow approach.
Finally, J2EE and .NET share a broad common foundation of standards, especially around XML and Web services. Web services are rapidly becoming the neutral zone between J2EE and .NET because they offer a self-describing, vendor- and technology-independent means of inter-application communication over the Internet. If it weren't for Web services, J2EE/.NET interoperability would be much more problematic and Internet-based communication among applications based entirely on either .NET or J2EE would be much more complex.
The multi-tiered approach typically followed for J2EE and .NET applications helps separate presentation from structure (for example, HTML at the presentation layer and XML at the business logic layer, and transaction from user interaction [see Table 1]).
Given the scope of the new enterprise model, it's important to follow an approach that supports role specialization so that all developers shouldn't feel it's necessary to understand the entire big picture (see Table 2 for J2EE/.NET perspectives by enterprise application development role types).
Here's Where They Differ
Although there's much common ground between J2EE and .NET, significant differences remain. Before moving forward, you'll need to make some choices. First, decide whether you want to program in a language other than Java. J2EE naturally focuses on the Java programming language, while .NET supports multiple programming languages—primarily C# and Visual Basic .NET, but also many others, ranging from Cobol to Eiffel. Language developers must comply with the .NET common language interface to take full advantage of the .NET common language runtime (CLR) and Framework. (It's definitely not your father's Fortran or Cobol.) There's nothing inherent to the JVM that precludes your using it with other programming languages, but at this point Sun is singularly focused on the Java programming language for its Java platform.
Is multi-vendor support an important consideration for you? Only one vendor supports .NET, while multiple vendors support J2EE. However, cross-vendor portability for J2EE is definitely not the fabled "write once, run anywhere" scenario. This is due in part to its organic growth model, where vendors add their own Web service features and other ex-tensions ahead of the J2EE specification process. J2EE vendor portability can be achieved by focusing on the parts of J2EE that are fully covered in the J2EE specification—such as servlets—but doing so is currently very constraining and even impossible. For example, EJB deployment dimensions aren't completely addressed in the J2EE specification.
Decide how important an in-market track record is to your organization. J2EE products have been available for years, while the first products incorporating the .NET CLR and Framework were released only at the beginning of 2002. Even though some key elements of .NET are based on Microsoft products and services that have been available for years (.NET Enterprise Services, built on the COM+ architecture, first appeared in 1996 as part of Microsoft Transaction Server), the J2EE product market is more mature.
Whichever way you go, be assured that both .NET and J2EE are rapidly evolving, as are the standards upon which they're based. Currently .NET leads in Web services, while J2EE has a broader overall scope. In general, you can expect both to evolve and expand very rapidly.
So far, the J2EE EJB model is more elaborate than its .NET counterpart. EJB flavors include (stateless and stateful) session beans and entity beans (component- and bean-managed), while .NET currently only includes support for components similar to stateless session beans. This represents a difference in architectural vision between Microsoft and the Java Community Process (JCP). Debates will continue until more real-world experience is available to help determine which approach is most effective for enterprises.
Determine whether ECMA standardization is important to your team. Sun controls the JCP and owns the Java specification. Although Microsoft maintains similar control over .NET, it has submitted key parts of it to ECMA for standardization. Despite its reputation as a predatory competitor, Microsoft could well out-maneuver the Java camp in terms of creating and building on industry standards.
Third-party support issues may have already made the decision for you. Component marketplaces are very practical for both J2EE and .NET. While such marketplaces have historically been limited primarily to Visual Basic add-ins, the rich component and Web service models supported in both J2EE and .NET are conducive to much broader component marketplaces. Support from application software vendors such as PeopleSoft, Siebel, and SAP will also contribute to the relative J2EE/.NET momentum. If SAP, for example, were to introduce a new version of its application suite that can be used as components in J2EE but not .NET, such a move would influence the strategies and priorities of enterprise application architects worldwide.
Finally, see for yourself. Sun, Microsoft, and other vendors have conveniently provided a set of resources that simplify the processes of exploring and comparing .NET and J2EE, and highlight both the common elements and the ways in which the approaches diverge.Sun created a Java Pet Store reference application as part of its Java blueprint. This sample application is representative of common enterprise applications. For example, it includes components for customer, order, product, and shopping cart implementations. It's a nontrivial reference, with more than 700 individual files in the 1.3 version. Not surprisingly, Microsoft and other vendors have seized upon the Pet Store application to showcase their products. Microsoft's version provides a useful means of comparing the .NET and J2EE approaches, especially in terms of understanding the different component middleware approaches embodied in EJB and .NET components.
Don't Worry, Make Users Happy
If you're like most enterprises, you'll migrate gradually to J2EE and .NET. Especially during tight economic times, nobody is eager to "rip and replace" working applications, and most enterprises will wait for more case studies before placing strategic bets on either technology.
Enterprises that focus on common areas between J2EE and .NET will benefit most because they'll leverage the transferability of skills and produce more reusable application components by using analysis and design techniques that apply to both, such as OO analysis and design using UML. Clearly, enterprises should work with their application and service suppliers to ensure that the suppliers' J2EE/.NET priorities align with their own. It would be unfortunate, for example, if a .NET-committed shop learned that its leading application vendor was leaning toward J2 EE instead of .NET—although it wouldn't exactly be the end of the world, thanks to XML Web services interoperability.
Almost all organizations will use a mix of J2EE and .NET, in part because the underlying platform choices are often dictated by existing application decisions. If your accounting department is already running Microsoft Great Plains, a J2EE version isn't likely to appear soon. Also, most organizations already use a mix of legacy Microsoft and Java-based tools and services, with the possible exceptions of Microsoft itself and some of the J2EE vendors, such as Sun.
Overall, you should anticipate that the coming enterprise architecture model will result in a raised least common denominator for enterprise applications and middleware, which will simplify and extend what was previously possible. Perhaps most significantly, as back-end development tasks are simplified, you'll actually be able to devote more attention to areas that directly impact the user experience and productivity. Imagine the benefits that directly impact user experience and productivity, such as a richer user experience and support for multiple device types. PDAs, smart phones, set-top boxes, and game consoles could be your next calling.
gyflyx 2011-05-27 16:22 1146
企业应用系统：C/S vs B/S三层J2EE架构之争
iammerryz 2012-08-10 10:52 8069
big1980 2011-09-08 14:48 1128
01 j2ee 企业应用和开发环境
moveofgod 2014-08-19 21:27 401
zpjy_yangjian 2012-04-01 09:10 1
轻量级Java EE企业应用实战（第3版）——Struts 2＋Spring 3＋Hibernate整合开发
broadview2006 2011-03-10 10:31 2487
wsb121a 2014-08-20 22:21 6
lv810 2007-08-24 09:00 53