Java vs .Net
Download
Report
Transcript Java vs .Net
Microsoft .Net vs. J2EE
Suresh Ramachandran
Duke Energy
J2EE – Enterprise Java
J2EE: Java 2 Enterprise Edition
Superset of Java 2 Standard Edition
(J2SE)
Adds enterprise features to Java Libraries
Defined through the Java Community
Process (JCP)
Wholly owned property of Sun
Microsystems
J2EE Solutions vs Microsoft .Net
Solutions
Similarities
Both multi-tiered, similar computing
technologies
Both support “standards”
Both offer different tools & ways to
achieve the same goal.
A lot of parallelism can be seen.
Very difficult to compare and qualify
the comparison because each has
its own advantages &
disadvantages.
Microsoft .Net vs. J2EE Comparison
Language
C# and Java both derive from C and C++.
MS says: “C# combines the power of VC++ with the ease
of usage of VB”
Significant features include garbage collection,
hierarchical namespaces) are present in both.
Different Syntax but same result.
Java runs on any platform with a Java VM. C# only
runs in Windows for the foreseeable future.
C# is implicitly tied into the CLR and is compiled
entirely into native code. Java code runs as Java
Virtual Machine and executes byte code
Microsoft .Net vs. J2EE
Comparison
Java vs. C#
// This is a comment in Java code
class HelloWorld{
public static void main(String[] args){
for(int i= 1; i<= 100; i++)
System.out.println("Hello!");
}
}
// This is a comment in C#
using System;
class HelloWorld{
static void Main(){
for(int i=1; i<=100; i++)
Console.WriteLine("Hello");
}
}
}
Microsoft .Net vs. J2EE Comparison
Presentation Layer
ASP(+) vs. JSP
ASP(+) can use Visual Basic, C#, and
possibly other languages for code
snippets.
JSPs use Java code (snippets, or
JavaBean references), compiled into
Java
Win Forms/Web Forms Vs Swing/Java
Server Faces
Microsoft .Net vs. J2EE - A technical
Comparison
Common Elements
Concepts
Presentation
Business Logic
J2EE
JSP/Servlets
EJB/Servlets
Language
Platform
DB Connectivity
Java
Any
JDBC
Web Services
Messaging
Runtime
Transaction
Distributed computing
XML Parser
JWSDP
JMS
JRE
JTA/JTS, XA
RMI, CORBA, SOAP
JAXP, Others
.NET
ASP.NET
Code Behind,
Remoted Classes
C#, VB.NET
Windows
ADO.NET (OLE-DB,
ODBC)
Web Services
MTS
CLR
Com+, DTC
SOAP, DCOM
Built-in
(System.XML)
Microsoft .Net vs. J2EE Scorecard
Criteria
J2EE
.NET
Ease Of Use (Development
Environment)
**
****
Scalability
***
**
Execute Java Code on Mainframe
Single Language Multiple Platforms
****
*
Java Can run on many platforms through the JVM
Multiple Languages Single Platform
*
****
VB,C#,J# all run in the same run-time environment
Reliability
**
****
VB/Com developmen in 1993
Performance
***
***
Equal Performance
*
***
VB code easiar to learn
Reuse
****
**
Deploy saame code on multiple platforms and
multiple projects
Open Standards
*****
*
Java, JVM are open standards
Overall
56%
51%
Speed of development
Comments
VB.net and C# are easier to use than J2EE
A typical .NET Enterprise Solution
IIS on W2k Server
Browser
Windows
Client
ASP
.NET
.NET
managed
component
SQL
Server
A typical J2EE Enterprise
Solution
Java App
Server
Servlet
EJB
JSP
Browser
Java
Client
DB
Server
RMI
Client
IIOP
Client
HTTP
Client
JMS
EJB Container
HTTP
Engine
.NET
App
SOAP
Client
HTTP
Client
RDBMS
EJB Container
IIS –
HTTP
Engine
JSP
Servlet
Servlet Container
J2EE Server
Component
Component
Component
CLR Host
Component
Component
Component
Comp. Services
CLR Host
ASMX
Controls
ASPX
ASP.NET
CLR Platform
Message
Queue
CORBA
Server
Other
Resource
RDBMS
Message
queue
Other
Server
Other
Resource
Porting Java Pet Store (Example) to .NET
15500
14,273
Lines of Code Required
14000
.NET Petshop
11500
Java Pet Store
9000
7500
5,891
5,404
4,410
5000
2,865
2,566
710
2500
Total Lines
of Code
User
Interface
Middle Tier
761
412
74
Data Tier Configuration
Microsoft .Net vs. J2EE Comparison
CLR vs JVM
C#
Java
VB Managed Lots of other
.Net C/C++ Languages
MSIL
Byte Codes
CLR
CTS GC Security
Runtime Services
JRE (JVM)
GC Security
Runtime Services
Windows OS
Mac
Win Unix Linux
Both are ‘middle layers’ between an intermediate
language & the underlying OS
Microsoft .Net vs. J2EE Comparison
JVM vs. CLR at a glance
JVM
CLR
Managed execution environment
X
X
Garbage Collection
X
X
Metadata and Bytecode
X
X
Platform-abstraction class library
X
X
Runtime-level security
X
X
Runs across hardware platforms
X
?
Microsoft .Net vs. J2EE Comparison
In J2EE, not in .Net
Entity Beans
Utility APIs like logging, preferences
Public profiling APIs like JVMPI, JPDA
In .Net, not in J2EE
Server side control
Serialization to XML
Compilation to native code
.Net Disadvantages
Security
.NET better than prior frameworks (DNA, DCOM,
ActiveX, etc.), but still based on Windows
Immaturity
Version 1.0 issues, likely to change in future
Language changes for developers new to .NET
Application migration to .NET costly
Not enough real world use yet to evaluate
Vendor lock-in
Future direction determined by Microsoft.
Choosing between Java/J2EE
and .Net
The ultimate choice usually depends not on
technical superiority, but on:
Cultural/”religious”/political preferences
Customer preference
Vendor relations
Cost
Platform Dependency
Skill set of your developers
Questions