2. Nov 6, 2014 compare.ppt 2
Java and .NET
• Java was created by Sun in 1992
• Microsoft introduced .NET and C# in 2000
• both platforms are object-oriented, type safe, and have automatic
garbage collection
• the two platforms have been competing vigorously on the desktop
• but especially in the area of server technology
• many developers become expert on one platform
• few have time to learn both
• the schism of understanding the two platforms widens
• due to misinformation and disinformation
• what are the strengths and issues for each platform?
3. Nov 6, 2014 compare.ppt 3
2008 forecast for market share of OS by platform: (2q 06)
Windows 40%
Unix 29%
Linux 15%
Others 16%
forecast market share of OS unit sales: (05)
in 2002 in 2003 in 2007
Windows 45% 59% 59%
Linux 20% 24% 33%
Unix 16% 10% 5%
Others 19% 7% 3%
market share of server shipments by platform in 2005:
Windows 65.6%
Linux 20.0%
Unix 9.5%
NetWare 4.2%
Others 0.7%
FROM: InfoTech Trends http://www.infotechtrends.com/
report from 2Q 2006, accessed on 4/8/2007
4. Nov 6, 2014 compare.ppt 4
main sections
1. simple programs
1. overview of platforms
1. why did Sun do it?
1. why did Microsoft do it?
1. Service Oriented Architecture – the peacemaker?
6. Nov 6, 2014 compare.ppt 6
// Java
public class Hello {
public static void main(String[] args) {
System.out.println("Hello world in Java");
}
}
// C#
namespace Hello {
public class Hello {
static void Main(string[] args) {
System.Console.WriteLine ("Hello world in C#");
System.Console.ReadLine();
}
}
}
‘ VB
Module HelloWorld
Sub Main
System.Console.WriteLine(“Hello World in
VB.NET”)
System.Console.ReadLine()
End Sub
End Module
console programs
7. Nov 6, 2014 compare.ppt 7
how much work is it to get this?
8. Nov 6, 2014 compare.ppt 8
mininal window
import java.awt.*;
import javax.swing.*;
public class Hello extends JFrame implements Runnable
{
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Hello());
}
public void run()
{
this.setSize(new Dimension(200,200));
this.setTitle("Hello in Java");
this.setVisible(true);
}
}
using System.Windows.Forms;
namespace TinyWindowApp
{
public class HelloForm : Form
{
static void Main()
{
Application.Run(new HelloForm());
}
public HelloForm()
{
ClientSize = new
System.Drawing.Size(200, 200);
Text = "Hello in C#";
}
}
}
9. Nov 6, 2014 compare.ppt 9
2 overview of platforms
10. Nov 6, 2014 compare.ppt 10
identical types of runtime environments
•J2SE (Standard) runtime
•desktop applications
•J2EE (Enterprise) runtime
•web applications
•J2ME (Micro) runtime
•runtime for gadgets
C# or VB.NET with VS Express
desktop application
IIS with VS Express Web
web applications
.NET compact framework
runtime for gadgets
11. Nov 6, 2014 compare.ppt 11
Java platform - .NET platform
• Java Virtual Machine (JVM)
aka Java Runtime Environment (JRE)
• Linux, Windows, Mac and Unix
• download from Sun
• JIT compiler and libraries
• Java Development Kit (JDK)
• Java compiler and utilities
• Java bytecode
• integrated development env. (IDE)
• Eclipse (free - IBM)
• Netbeans (free - Sun)
• application servers
• Tomcat
• Glassfish (Sun)
• BEA Weblogic
• IBM Websphere
• Microsoft .NET Framework 2.0
aka .NET common language runtime (CLR)
• all versions of Windows (40+)
• download from Microsoft
• JIT compiler and libraries
• NET framework 2.0 SDK
• C# and VB.NET compilers and utilities
• Common Intermediate Language (CIL)
• integrated development env. (IDE)
• Visual Studio Express (free - Microsoft)
• application servers
• Microsoft Internet Information Server (IIS)
FREE
NOT
12. Nov 6, 2014 compare.ppt 12
features 1
•virtual machine
•platforms (all major OS’s)
•spec
•implementations
•libraries
•languages
•Java
•Jython
•Groovy
•web servers (many vendors)
•platforms (Unix, Linux)
•scalability
•cost
•web capabilities
•servlet
•JSP
•JSF
virtual machine
platforms (all versions of Windows)
spec
implementations
libraries
languages
C#, VB.NET, J# from Microsoft
many others from third parties
(Haskell, Lisp, Python, COBOL, Fortran, etc.)
web servers (just one!)
platforms (most Windows)
scalability
cost
web capabilities
handler
ASP (.NET)
(forgot equivalent name)
13. Nov 6, 2014 compare.ppt 13
features 2
•native code calling
•components
•beans
•environments
•applet (in browser)
•servlet (in server)
•Web Start
•installs from web
•caches on user’s PC
•deployment
•.jar
•.war
•.ear
•.class
•complex, painful learning curve that
differs for each web server,
container, and IDE
•automated via ANT
•XML, like make on Unix
native code calling
components
.DLL
environments
ActiveX (in browser)
handler (in server)
Smart Client
installs from web
caches on user’s PC
deployment
.exe (on file system)
.exe (in GAC)
.dll (on file system)
all builds and web installation is
automatically handled by Visual
Studio (Microsoft’s IDE)
14. Nov 6, 2014 compare.ppt 14
features 3
•databases
•JDBC
•CORBA
•binary object remoting
•XML
•via 3rd
-party add-ons until Java 6
•IDE’s
•Eclipse, with 1000’s of plugins
•NetBeans (from Sun) – also free
•service oriented architecture (SOA)
•annotations appearing
•web services WS-I
•supported but difficult (3rd
party)
•new partial automation in Java 6 and
latest NetBeans IDE
•I haven’t evaluated these yet
databases
ODBC
COM
binary object remoting
XML
excellent support early one
IDE’s
free versions of Visual Studio
some third party IDE’s
service oriented architecture (SOA)
annotations
web services WS-I
superbly automated by Visual Studion
since 2005
15. Nov 6, 2014 compare.ppt 15
the JRE and .NET runtimes include lots of libraries
• programs can call a huge body of pre-written code
• these reusable components are called the Class Libraries
• in Java, sometimes they are also called packages or Java API’s
• in .NET, they tend to be called the framework class libraries
• the libraries are designed to be used identically
• in Java, regardless of the underlying operating system
• in .NET, regardless of the underlying version of Windows
OR which language is being used
Editor's Notes
NOTE:
namespace
case sensitive
semi-colons after each statement
OPTIONAL incoming arguments
the runtime and its JIT compiler technology
the framework libraries
the compilers (C#, VB.NET, C++, J#)
Previous programming languages also required a runtime subsystem to execute
Pascal compiled down to intermediate P-code, which was then interpreted
Visual Basic (before the .NET versions) compiled to an intermediate code which required the VB runtime library to be installed
bytecode is big endian (first made for Unix), CIL is little endian (Intel)
the JVM (JRE) and CLR and not interpreters
they use just-in-time (JIT) compiler technology
they both compile procedures to native code immediately before the code needs to execute
A few other languages now exist which can share these rich libraries
Jython, JRuby
.NET Framework Class Libraries, aka Base Class Libraries