JavaJ 2 EE and NET Similarities and Differences

  • Slides: 59
Download presentation
Java/J 2 EE and. NET Similarities and Differences in the Dominant Enterprise Computing Platforms

Java/J 2 EE and. NET Similarities and Differences in the Dominant Enterprise Computing Platforms Kyle Cordes Oasis Digital Solutions Inc. Gateway Java User Group Sep. 2, 2003

Kyle Cordes z Developer / “Architect” z Consultant and Trainer z Proponent of agile,

Kyle Cordes z Developer / “Architect” z Consultant and Trainer z Proponent of agile, iterative, test-intensive development z Java, EJB, Oracle, SQL Server, Delphi, C++, Python, Ruby, EJB, XML, multi-tier, etc. z kylecordes. com z Oasis Digital Solutions Inc. y. Outsourced development and other services Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Disclosures - I Like all of the following: z Java z. NET z Choice

Disclosures - I Like all of the following: z Java z. NET z Choice of deployment platforms z Great development tools z Value for the customer / user Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Quick Poll - How many of you: z Use Java at work? z Use.

Quick Poll - How many of you: z Use Java at work? z Use. NET at work? z Use a non-Java language on the JVM? z Deploy to Windows servers? z Deploy to Unix servers? Solaris? AIX? HPUX? z Deploy to Linux servers? z Use a non-Sun JVM, from IBM, HP, etc. ? Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Agenda z Overview z Technical Similarities and Differences z Non-Technical Issues z Q&A Copyright

Agenda z Overview z Technical Similarities and Differences z Non-Technical Issues z Q&A Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

What is Java? What is J 2 EE? z Platform (Infrastructure under your app)

What is Java? What is J 2 EE? z Platform (Infrastructure under your app) z Managed runtime environment z Marketing term for a diverse set of technology z Spec and Product (from Sun and many others) z Market z J 2 EE is the name of the “high-end” features, specs, libraries, etc. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

What is. NET? z Platform (Infrastructure under your app) z Managed runtime environment z

What is. NET? z Platform (Infrastructure under your app) z Managed runtime environment z Marketing term for a diverse set of technology z Product (from Microsoft) z Spec (though less so) z Market (though less so) z There isn’t an overriding brand name for the enterprise features, some of them are WSE Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

What Else is. NET? z Marketing term extends beyond the platform: y. NET My

What Else is. NET? z Marketing term extends beyond the platform: y. NET My Services y. Software as a Service y. Synonym for “new”, like “NT” z Most of this is going away, Microsoft is removing the. NET brand name from the next version of many products, as already happened with Windows Server 2003. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

The Essence of. NET z Platform for building applications - like an OS z

The Essence of. NET z Platform for building applications - like an OS z Much like Java at both macro and micro level z Microsoft’s alternative vision for what a Java-like system should look like - “the same, but different” z The Future of the Windows platform Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

. NET from a Java Perspective z Start with most of the best aspects

. NET from a Java Perspective z Start with most of the best aspects of the Java platform (both features and texture) z Same overall idea, different names and many different design decisions z Improve on some areas, with various twists z Puts some things in platform / languages which are conventions or add-ons in Java. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Platforms z Java tends to make platform irrelevant z. NET integrates with and boosts

Platforms z Java tends to make platform irrelevant z. NET integrates with and boosts the value of the Windows platform (*) z (I’ll mention Mono later) Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Technical Similarities and Differences

Technical Similarities and Differences

Runtime Environment z Both provide a managed runtime environment: y. Intermediate Language / bytecode,

Runtime Environment z Both provide a managed runtime environment: y. Intermediate Language / bytecode, not native code y. Garbage collection y. Security z Java JRE offers JIT and Hotspot z. NET CLR offer JIT and ngen z Common misconception among. NET partisans is that Java is interpreted Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Virtual Machine vs. Runtime z I’ve seen the idea put forth that a “runtime”

Virtual Machine vs. Runtime z I’ve seen the idea put forth that a “runtime” is greatly different from a virtual machine. z Technically speaking, not much difference Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Languages z Java Platform: z. NET Platform: z Java language z C# z (and

Languages z Java Platform: z. NET Platform: z Java language z C# z (and many others, though z Visual Basic. NET not widely used) z C++ with Managed Extensions z (and many others, more likely to see wide use) Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Major C# / Java Language Differences z Properties z Attributes z Events / Delegates

Major C# / Java Language Differences z Properties z Attributes z Events / Delegates z Value Type (Structs) z unsigned types z Auto-boxing z explicit interface implementation z Non-virtual methods by default (like Delphi) z Override keyword z Different method lookup rules z foreach z multi-dimensional arrays z using Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

C# Unsafe Code z Java: y. Write your unsafe code in C / C++

C# Unsafe Code z Java: y. Write your unsafe code in C / C++ / etc. y. Call it with JNI - VM checks security z C#: y. Use the same language y. Mark it as unsafe y. Runtime checks security z Given that some operations require unsafe code, writing it in the same language seems like a better solution to me. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Libraries z Java class libraries y java. io yjavax. sql z. NET BCL Base

Libraries z Java class libraries y java. io yjavax. sql z. NET BCL Base Class Library y. System. IO y. System. XML y. . . z Roughly comparable in scope Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Naming Conventions z Most of. NET naming/casing conventions are different from Java’s y. Method.

Naming Conventions z Most of. NET naming/casing conventions are different from Java’s y. Method. Name vs method. Name y. Package. Name vs package. name z Different just to be different, in my opinion z Many more things are cased Like. This, so the casing carries slightly less information z Microsoft no longer recommends Hungarian Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

DBMS Connectivity z JDBC z JDO z SQL/J z ADO. NET z ODBC z

DBMS Connectivity z JDBC z JDO z SQL/J z ADO. NET z ODBC z OLE-DB, which also supports nonrelational data sources z JDBC Type 4 z. NET Managed Provider Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Deployment z Java: y. Class files / Jars z. NET: y. Assemblies z J

Deployment z Java: y. Class files / Jars z. NET: y. Assemblies z J 2 EE: Choose and install J 2 EE server, generate and compile EJB stubs, set a bunch of XML files right, create nested JARs, EARs, etc. z. NET: Copy assemblies and a few config files to a directory served by IIS Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

JARs, EXEs and DLLs z. NET Assemblies are substantially similar to JARs, but they

JARs, EXEs and DLLs z. NET Assemblies are substantially similar to JARs, but they have extra header information to make them valid Win 32 EXEs or DLLs z The header includes a stub to connect to the. NET Runtime z Result: to the end user, . NET applications have the same kinds of files as native. z Big advantage in user acceptance Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Classpath z Commonly complained about by Java detractors z. NET has a similar mechanism:

Classpath z Commonly complained about by Java detractors z. NET has a similar mechanism: load from the same directory, load from a global location (GAC), load from configured locations (much like a classpath) z. NET does not have classes as standalone files, which simplifies things. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Versioning z. NET Assemblies carry metadata with version information z. NET Assemblies reference each

Versioning z. NET Assemblies carry metadata with version information z. NET Assemblies reference each other by version z Side-by-side deployment is easy, without the need to segregate Jar files z Version interop issues are similar - it’s possible to load class Foo version 1. 5 and class Foo version 2. 0, but they aren’t the same class. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Web Presentation Toolkits z Java: z JSP/Servlets z Tab libraries z JSF z Third

Web Presentation Toolkits z Java: z JSP/Servlets z Tab libraries z JSF z Third party toolkits (Struts etc. ) z. NET: z ASP. NET z Server-side controls y Server-side On. Click z Less emphasis on MVC z Some toolkits provide server-side On. Click just like the. NET Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Rich Client Presentation Toolkits z Java: z AWT z Swing z “Lightweight” z Layout

Rich Client Presentation Toolkits z Java: z AWT z Swing z “Lightweight” z Layout management, the bane and the glory of Swing development z SWT and other alternatives available z. NET: z Win. Forms z “Heavyweight” = Native z Less focus on automatic layout, most layouts are pixel-based z An SWT clone is available z Win. Forms is “ 1. 0” and it shows Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

XML Support z Java: JAXP and other APIs, implementations from many vendors z. NET:

XML Support z Java: JAXP and other APIs, implementations from many vendors z. NET: Built-in (System. XML, also including interesting pull-model parsing) x. Built-in Schema, Xpath, XSLT, SOAP 1. 1 z. NET uses XML itself extensively, while Java uses lots of Properties files for older configurations; this is an artifact of the timing. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Distributed Computing z J 2 EE: RMI, CORBA, SOAP z. NET: Remoting, SOAP, DCOM

Distributed Computing z J 2 EE: RMI, CORBA, SOAP z. NET: Remoting, SOAP, DCOM z There are third party. NET COBRA implementations. z There are third party Java DCOM bridges Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

RPCs / Distributed Objects z RMI: z JRMP or IIOP wire protocol z RMI

RPCs / Distributed Objects z RMI: z JRMP or IIOP wire protocol z RMI Registry z Stubs/Skeleton z Can customize with Socket Factory z Distributed Garbage Collection! z. Net Remoting: z XML or native wire protocol, over HTTP/TCP z Activator z Can customize with Channels z Distributed Garbage Collection! Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Web Services z RPCs, Metadata, Discovery, Directories z SOAP, WSDL, UDDI, etc. z. NET:

Web Services z RPCs, Metadata, Discovery, Directories z SOAP, WSDL, UDDI, etc. z. NET: y. SOAP and WSDL in the box from Day One y. More coming in the “WSE” z Java: y. Some support in the box ymany strong solutions from 3 rd parties y. Much more in the box coming soon Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

[Web. Method] z Extensively hyped, great for demos z Not an important difference in

[Web. Method] z Extensively hyped, great for demos z Not an important difference in a large app z Provided by several Java WS implementations, I was using one before. NET existed z Ludicrous to hold the fact against Java, that Java predates web services z Upcoming versions of Java and. NET will offer very similar WS support Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Clustering z J 2 EE: y. Clustering provided by App Server y. Sessions maintained

Clustering z J 2 EE: y. Clustering provided by App Server y. Sessions maintained by the App Server y. Platform provides the spec z Net: y. Clustering provided by OS y. Sessions maintained by IIS/OS/runtime y. Platform (Windows Server) provides the implementation Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Implementing Complex Services z Service Oriented Architectures are now the dominant paradigm y. Client

Implementing Complex Services z Service Oriented Architectures are now the dominant paradigm y. Client app doesn’t know whether server uses domain objects z Stateless services z see Patterns of Enterprise Application Architecture, Fowler Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

The J 2 EE Approach z Stateless Session Beans for the Service Facade z

The J 2 EE Approach z Stateless Session Beans for the Service Facade z Entity Beans for persistance z Many variations and recommendations out there Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

The. NET Approach z Web Services or Remoting for the Service Facade z O/R

The. NET Approach z Web Services or Remoting for the Service Facade z O/R mapping is not in the box z Instead, very convenient and powerful data access components are used z Thus, Transaction Scripting favored over Domain Objects z Of course, many developers use O/R mapping and domain-object-based development. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Message Oriented Middleware z Java: y. JMS and MDB specification z. NET: y. Easy

Message Oriented Middleware z Java: y. JMS and MDB specification z. NET: y. Easy access to Microsoft Message Queue y. COM+ Queued Components (similar to MDBs) Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Small Device Support z Java offers J 2 ME y Many third party variations

Small Device Support z Java offers J 2 ME y Many third party variations also! z J 2 ME is Java with many features removed z Run on many cell phones, Palm devices, etc. z Much greater market penetration so far z. NET offers the Compact Framework z. NET CF is the. NET Framework with many features removed z Runs on Pocket PC, Smart. Phones, various embedded devices Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

In Java / J 2 EE, not in. Net z O/R Mapping, in the

In Java / J 2 EE, not in. Net z O/R Mapping, in the form of Entity Beans z Wider array of utility APIs z Public profiling and debugging APIs like JVMPI, JPDA Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

In. Net, not in Java / J 2 EE z ASP. NET Server side

In. Net, not in Java / J 2 EE z ASP. NET Server side controls z XML Serialization z Precompilation to native code z Enumerations, Attributes, etc. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Java /. NET Interoperability z Easy to call back and forth with Web Services

Java /. NET Interoperability z Easy to call back and forth with Web Services y. Appropriate only for large-grained EAI interaction z Much Faster to call back and forth with CORBA z Fast but inpleasant to interoperate with COM Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Mono z “an effort to create an open source implementation of the. NET Development

Mono z “an effort to create an open source implementation of the. NET Development Framework” z Runs on Linux z Includes runtime, compiler, partial class libraries, various other infrastructure z http: //www. go-mono. com/ z Ximian, the sponsor, recently acquired by Novell z Questionable legal status given the MS patents Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Coming Soon in Java: z Generics z Auto-boxing z for() that works like foreach()

Coming Soon in Java: z Generics z Auto-boxing z for() that works like foreach() z Attributes z Typesafe enums Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Coming Soon in. NET: z Generics z Object. Spaces (transparent persistance like JDO? XPath-like

Coming Soon in. NET: z Generics z Object. Spaces (transparent persistance like JDO? XPath-like access to objects? ) z Async interfaces for many more opertaions Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

The Pet Shop z This Sun example web application has been used for a

The Pet Shop z This Sun example web application has been used for a number of highly publicized benchmarks z None of them really mean much z Overall, you’ll get similar performance with Java and. NET Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Markets, Money, and Other Non. Technical Issues

Markets, Money, and Other Non. Technical Issues

Deployment Platforms z Java: Almost any z. NET: Any platform you want, as long

Deployment Platforms z Java: Almost any z. NET: Any platform you want, as long as it’s Windows z To some customers, the first point is a big advantage; to others, the second is a big advantage. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Open Source z Lots of activity on both Java and. NET z Many open

Open Source z Lots of activity on both Java and. NET z Many open Java projects have been ported to. NET. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Jobs z Java is still apparently far ahead z St. Louis has a remarkable

Jobs z Java is still apparently far ahead z St. Louis has a remarkable concentration of large Java shops z There are many MS shops here also (and quite a few MS, and now. NET-centric consulting firms). z Microsoft technology very popular is small/ medium sized firms Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Market Size Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Market Size Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Innovation z Microsoft can advance. NET and C# forward faster, because they have less

Innovation z Microsoft can advance. NET and C# forward faster, because they have less involvement / resistance from other companies Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Money - What’s it cost to develop? z You can develop for either for

Money - What’s it cost to develop? z You can develop for either for little or no money y. JDK free download y. NET Framework SDK free download z Some features are not in the free downloads Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Cost Per Developer z Java can cost almost nothing per developer year; or it

Cost Per Developer z Java can cost almost nothing per developer year; or it can cost several thousand dollars per developer year. z Microsoft offers a compelling package with MSDN Universal Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Deployment Cost z. NET deployment is “free” if you don’t count the OS z

Deployment Cost z. NET deployment is “free” if you don’t count the OS z J 2 EE can be anywhere from free (Linux + JBoss) to very expensive (HPUX, AIX + Web. Logic or Web. Sphere, etc. ) z Unreasonable to compare the cost of. NET and J 2 EE per se, since the Java cost can vary tremendously by which app server you choose. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

The Bottom Line z More alike than different z Technically, it’s unlikely that you

The Bottom Line z More alike than different z Technically, it’s unlikely that you will succeed with one and fail with the other z Java is many places where. NET is not z. NET is much better integrated with Windows, obviously the dominant platform for many customers z Java is a broad market with many producers, while. NET is very MS-centric. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Talk Offer z This talk, or one like it with more details z In

Talk Offer z This talk, or one like it with more details z In your organization z For Developers z For Managers z No Cost (in town) z No Obligation Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

XPSTL - Extreme Programming in St. Louis z Interested? Join the mailing list at

XPSTL - Extreme Programming in St. Louis z Interested? Join the mailing list at xpstl. org z Worthwhile even if you are only interested in parts of XP… for example, come learn about test -intensive development. z Tomorrow night at CAIT, see web site for details. Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Questions? z Experiences? z Critiques? z Advice? Copyright © 2003 Oasis Digital Solutions Inc.

Questions? z Experiences? z Critiques? z Advice? Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

Links z http: //www. daimi. au. dk/~beta/ooli/Compare. ht ml Copyright © 2003 Oasis Digital

Links z http: //www. daimi. au. dk/~beta/ooli/Compare. ht ml Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes

THE END z Kyle Cordes kyle@kylecordes. com (636) 219 -9589 z Slides will be

THE END z Kyle Cordes kyle@kylecordes. com (636) 219 -9589 z Slides will be on my web site, http: //kylecordes. com Copyright © 2003 Oasis Digital Solutions Inc. / Kyle Cordes