A Comparative Analysis of Microsoft's .NET and Sun's J2EE

advertisement
A Comparative Analysis of
Microsoft’s .NET and Sun’s J2EE
Outline

Part 1


Part 2




High level description
Pros & Cons
Paralleling Technologies
Part 3



Introduction
Key Differences/ Underlying Philosophies
JVM vs CLR
Part 4

.NET Overview
Part 1
Introduction
1. Application Servers

In the beginning, there was darkness
and cold. Then, …
mainframe
terminals
terminals
Centralized, non-distributed
Application Servers

In the 90’s, systems should be client-
server
Application Servers

Today, enterprise applications
use the multi-tier model
What is...?


Enterprise Computing
A framework





Ties together a bunch of discrete
objects/components
Makes it easier to use complex technologies.
A Wrapper
A skeleton/building block
J2EE and .NET
Forrester Report: The State of
Technology Adoption
Source: http://download.microsoft.com/download/c/7/5/c75837dc-90bb-44d8ae70-db7bcc5980b9/TheStateofTechnologyAdoption.pdf
Part 2
High level description
Pros & Cons
Paralleling Technologies
J2EE High Level Description



A specification (not a product)
Based on J2SE
http://java.sun.com/j2ee/compatibility.h
tml
J2EE High Level Description
App 1
App 2
Application
Client
Dynamic
HTML
Pages
JSP Pages
Client
Tier
Client Machine
Web
Tier
J2EE Server Machine
EJB
DB
EJB
Business
Tier
DB
EIS
Tier
DB Server Machine
J2EE High Level Description

Containers



Access underlying Services
Interface between component and lowlevel functionality
Specific types of containers for different
components:


EJB Container
Web Container
J2EE High Level Description
Server Tier
Client Tier
Web Container
EIS Tier
EJB Container
Applet
Container
Session Beans
Entity Beans
Application
Client
Container
JSP Pages
&
Servlets
JavaBeans
Message-Driven
Beans
Datab
ase
J2EE High Level Description

Client Tier

Web Clients


Applets, HTML, XML, etc..
Application Clients

GUI
J2EE High Level Description

Web Tier

Servlets


javax.servlet.Servlet
JSP Pages

Compiled into a servlet
J2EE High Level Description

Business Tier

Enterprise Java Beans

Session Beans




Stateless
Statefull
Entity Beans
Message Driven Beans
.NET High Level Description

Developer Choice


Common Language Runtime
Platform Interoperability

"You very seldom want to port an existing
application between platforms, but you do want to
interoperate between applications regardless of
platform; therefore, industry standard support for
Web Services is of great importance.”

-Dan Fox, Solutech, Inc. Author of: Building Distributed
Applications with Visual Basic.NET
.NET Framework
Web Services
Windows Forms
Web Forms
Data and XML Classes
(ADO.NET, SQL, XML, etc.)
Framework Base Classes
(IO, string, net, security, threading , text, etc.)
Common Language Runtime
(debug, exception, type checking, JIT compilers)
Windows Platform
.NET Framework


Programming model of the .NET
environment for building, deploying,
and running Web-based applications,
smart client applications, and XML Web
services.
It manages much of the plumbing,
enabling developers to focus on writing
the business logic code for their
applications.
.NET Framework

The .NET Framework includes the
common language runtime and class
libraries.
The .NET Framework
VB
C++
C#
J#
Other
Common Language Specification
Web Forms
XML Web Services
Windows Forms
Base Class Library
Common Language Runtime
(JIT compilation, memory management, etc.)
Windows
Common Language Runtime

The Common Language Runtime (CLR) is a
runtime engine




Manages .NET Code (such as C# applications)
Provides features such as memory management,
thread management, object type safety, security,
etc.
Is a part of the .NET Framework
Managed code


Code that targets the CLR
Any .NET Language, including C#, Visual Basic, C++,
Java, Cobol, etc.
Running User Written Code

When you compile your application, you
create an assembly


IL contains all information about your
application


Intermediate language (IL)
Methods, properties, events, security, etc
JIT



Just in time compilation
Happens when someone executes your code
Turns IL into actual machine specific code
JIT Process
Compilation
Source
Code
Language
Compiler
IL Data
Metadata
Execution
JIT
Native
Compiler
Code
Common Language
Specification



CLS describes the requirements that make a
.NET language compliant with the common
language runtime
Allows .NET languages to interoperate
Languages may include non-compliant
features
 No interoperability
The Framework Class Library

A huge collection of reusable types


For use by any managed code


Classes, interfaces, enumerations and structures
Including code written in any managed
programming language
Types for



Common tasks such as collections, file IO,
memory and thread management
GUI and window manipulation
Web form and web service applications
The Framework Class Library

Totally object oriented toolbox for developers
Ships as part of the .NET Framework
Using the FCL


Types are arranged in a hierarchy of
Namespaces
A type’s full name includes its namespaces


Form class is actually
System.Windows.Forms.Form
Use using to indicate namespaces in source
code
Using the FCL


Assembly references are necessary for
many types
The SDK documentation is critical for
using SDK types



Includes descriptions
Often includes useful code samples
Indicates namespaces and assemblies for
types
Pros and Cons of J2EE

Pros





Portability
Vendor choices for tools and application servers
Proven Track record (Java – 1995, J2EE – 1998)
Rich developer community, many free tools.
Cons





Complex application development environment
Tools can be difficult to use
Java Swing limited for developing GUI's (?)
No provided IDE
Performance
Pros and Cons of .Net

Pros





Easy to use tools
Strong framework for building GUI's
Language support
Performance
Cons



Portability
Choice of IDE's Limited
A lot of piecing together components.
Paralleling Technologies
Microsoft .NET
J2EE
Language Supported
Over 20 languages
Java
Support Libraries
.NET framework SDK
J2SE, plus the APIs : JDBC,
JSP, EJB, JMS, JAXP, JCA,
JFC, JNDI etc as defined in
the J2EE specification
IDE’s
Visual Studio
Jgrasp, Jbuilder, Eclipse,
Netbeans
Presentation Tier
ASP.NET
JSP and Servlets
Database Tier
ADO.NET and ODBC
JDBC
Paralleling Technologies
Microsoft .NET J2EE
Business Tier
COM
EJB
Source Compilation
MSIL, .EXE, .DLL
.CLASS
Desktop support
Windows Forms and Web
Forms
Java Swing and AWT
Web Services
SOAP and XML
JAXP and SOAP
Server Technology
IIS
Weblogic and Websphere
IL CLR vs. JVM
IL Common Language
Runtime
Java Virtual Machine
Part 3
Key Differences
JVM vs CLR
.Net and J2EE key differences

Fundamental Philosophy:

“One language, Many Systems” vs. “Many
Languages, One System.”


Languages Supported
CLR vs. JVM
J2EE's Java Virtual Machine


hypothetical computer.
Translates compiled Java code (byte-code)
into machine language for your computer.



A Java byte-code interpreter.
Provides the portability of the J2EE
framework.
Java can run on any computer with a JVM
.NET's Common Language
Runtime

Runtime Engine


CLR Portable Executable (PE) files are either
EXE or DLL files



Loads classes, performs JIT compilation, executes
code, handles garbage collection.
Consist of metadata and code.
Run on top of CLR.
Microsoft Intermediate Language (MSIL or IL)

Any .Net language can be converted into IL.
.NET's Common Language
Runtime

.Net treats all languages as equal


C# class == VB.NET class
How:

Common Type System (CTS)

Common Language Specification (CLS)
.NET's Common Language
Runtime

Common Type System

Every language must abide by CTS

Important types supported:

Value types

Reference types

Boxing and unboxing

Interfaces

Delegates
.NET's Common Language
Runtime

Common Language Specification


Problem: C++ is case sensitive but VB.NET
is not.
Solution: define a set of basic rules that
are required for language integration.
.NET's Common Language
Runtime

CLR Execution

Major components:

Class loader

Verifier

JIT compilers

Execution Support and Management
.NET PE Files (Metadata and IL)
Class Loader
CLR Virtual Execution Engine
Verifier
JIT Compilation
JIT Compiler
Execution Support and Management
garbage collector, security engine, code manager, exception
manager, thread support, etc.
JVM vs. CLR

Both abstract the underlying platform differences.


JVM only supports Java, CLR supports any language
represented in its Common Intermediate Language
(IL)


Portability (J2EE JVM) vs. Language Support (.NET CLR)
April, 2003: CLI (subset of CLR) recognized as an
international standard.
JVM interprets Java, IL is never interpreted.
Part 4
.NET Overview
.NET Developer Tools


Visual Studio.NET is an integrated
development environment for developing
.NET applications
It includes support for multiple languages




Visual Basic.NET
Visual C#.NET
Visual J#.NET
ASP.NET
.NET Developer Tools

It can be used to develop client based
applications and Web based applications
ASPX

Microsoft Active Server Pages, .NET


Old ASP




IIS Server
HTML with embedded server scripts
Session Support
VB Scripts
ASPX.NET



Separation of HTML and code
Additional State Preservation Capabilities
Multiple Languages
Running .NET Applications



IIS is comparable to the J2EE
Application Server
The .NET Framework redistributable
package includes everything you need
to run applications developed using the
.NET Framework.
Version 1.1 is the current version of the
.NET Framework
Internet Information Services
IIS




Internet Information Services (IIS,
sometimes Server or System) is a set of
Internet-based services for servers using MS
Windows
Used for corporate, commerce and secure
websites.
Originally, it was supplied as part of the
server editions of Windows NT
IT is integrated with Windows 2000 and
Windows 2003 Server.
IIS





IIS is bundled with Windows operating
systems
Default web directory is C:\Inetpub\wwwroot
Publish applications to http://localhost
Installation of Visual Studio .NET will install
the .NET Framework
On systems without Visual Studio, you need
to install the .NET Framework

insure that the .NET Framework matches that
used by Visual Studio .NET
IIS

The current version is IIS 6.0 and includes
servers for FTP, SMTP,NNTP and HTTP/HTTPS
and is only available for Windows Server
2003.


IIS 6.0 major security enhancements
IIS 5.1 , a restricted version, that supports
one web site and a limited number of
connections is also supplied with Windows
2000 and Windows XP
.NET Online Resources





http://www.msdn.microsoft.com/netfra
mework/
http://www.gotdotnet.com/
http://www.startvbdotnet.com
http://www.asp.net
http://www.dotnetwire.com
J2EE Online Resources





http://java.sun.com/j2ee/index.jsp
http://library.theserverside.com/rlist/ter
m/J2EE.html
http://www.javaworld.com
http://www.springframework.org
http://www.eclipse.org
Additional References




Platt, David S.: Introducing Microsoft .NET 3rd
Edition
Thai, Thuan & Lam, Hoang Q.: .NET
Framework Essentials, 3rd Edition
Sharp, John & Jagger, Jon: Microsoft Visual
C# .NET Step by Step.
Farley, Jim, Crawford, William & Flanagan,
David: O'Reilly's Java Enterprise In a Nutshell
Download