C# and .Net vs. Java - Apache Software...

26
sysis interactive simulations aG C# and .Net vs. Java Bernhard Herzog, May 2001 Copyrights (c) 2001, Sysis AG

Transcript of C# and .Net vs. Java - Apache Software...

sysis interactive simulations aG

C# and .Net vs.Java

Bernhard Herzog, May 2001Copyrights (c) 2001, Sysis AG

sysis interactive simulations aG

Agenda

§ Introduction§ Evolution of Component Software§ The Common Language Runtime§ HalloWorld in C#, VB.Net and Java§ Assemblies vs. JAR-Files§ ASP.Net§ XML, SOAP and WebServices§ Microsoft Visual Studio 7§ Q & A

sysis interactive simulations aG

The Actors

§ James Gosling§ Anders Hejlsberg§ Bill Gates, Chief Software Architect,

Microsoft§ Larry Ellison, CEO, Oracle§ Louis Gerstner, CEO, IBM§ Scott McNealy, CEO, Sun

sysis interactive simulations aG

Evolution of Component Software

Smalltalk

C

Basic

CGI ISAPI

VisualBasic

C++

Java

COM

ASP

MTS/COM+

WAM

JSP/Servlet

YouAre

Here

EJB

Delphi

sysis interactive simulations aG

CLR = Common Language Runtime

§ Technology for integrating softwarecompontents from multiple organizations§ Pervasive type system that spans programming

language and operating system boundaries

sysis interactive simulations aG

CLR: Pervasive TypeCOM: Type Fragmentation

Lib1 Lib2 Lib3

Lib1 Lib2 Lib3

COM, CORBA Type System Internal Type System

CLR Type System

sysis interactive simulations aG

Language Choices

IL ASM

MC++

C#/VB.NET

Productivity

Con

trol

sysis interactive simulations aG

HalloWorld in C#, VB.Net and Java

public class HalloWorld{

public static void Main(){

System.Console.WriteLine("Hello, World");}

}public class HalloWorld{

public static void main(String argv[]){

System.out.println("Hallo, World");}

}

sysis interactive simulations aG

Assemblies vs. JAR-Files (1)

main.cs csc.exe /t:exe /r:aux.dll main.cs main.exe

aux.cs csc.exe /t:library aux.cs aux.dll

sysis interactive simulations aG

Assemblies vs. JAR-Files (2)

jar cf Aux.jar demo\Aux.class Aux.jar

Aux.java jikes demo\Aux.java Aux.class

Main.java jikes -CLASSPATH ... Main.java Main.class

sysis interactive simulations aG

Assemblies vs. JAR-Files (3)

§ ildasm§ Global Assembly Cache vs. CLASSPATH and

lib/ext§ Versioning, Culture, Originator§ AppDomains vs. ClassLoaders

sysis interactive simulations aG

C# Language Features§ Boxing, Structs§ Preprocessor§ Enums§ Properties („Component Oriented“)§ Indexers (like operator[], but parameter of any type),

foreach§ operator overloading, conversions§ Delegates and Events§ XML Documentation§ Attributes§ no checked Exceptions

sysis interactive simulations aG

ASP.NET

§ Server-side controls that fire events (drag anddrop in forms editor)§ Pages are compiled as with JSPs§ Session state can be moved to other process,

other machine or to DB§ Breakpoints supported§ Full Power of .NET Framework available

sysis interactive simulations aG

ASP.NET (and ADO.NET)<%@ Page Language="C#" Debug="true" %><%@ Import Namespace="System" %>

<html><body><%

for (int i = 0; i < 10; i++){

%><%= i %><%

}%></body></html>

sysis interactive simulations aG

XML

§ Technology for representing data andinformation§ Type system provided by XML Schemas (XSD)

sysis interactive simulations aG

XML Type System

Lib1 Lib2 Lib3

XML Type System Internal Type System

sysis interactive simulations aG

XML Infoset (Abstract Model)vs. XML + NS (Concrete Syntax)

Web

Ser

ver

XMLX

ML

Par

ser

XML-basedProcessingSoftware

sysis interactive simulations aG

TDS (or equivalent)X

mlR

eade

r Int

erfa

ceXML-basedProcessingSoftware

XML Infoset (Abstract Model)vs. XML + NS (Concrete Syntax)

OLE

DB

/Sys

tem

.Dat

a

sysis interactive simulations aG

XML Schema

§ Replacement for DTD§ Reflection capabilities for XML§ Schema compilers could eventually replace

tedious XML-Parsing

sysis interactive simulations aG

SOAP

§ RPC-Style Applications§ WSDL: Web Service Description Language

(MS+IBM)§ UDDI: Universal Description, Discovery and

Integration (MS+IBM+Ariba)§ Example: Book Reviews Lookup via ISBN number

sysis interactive simulations aG

Web Service (ASMX)

<%@ WebService Language="C#" Class=“Service" %>

using System;using System.Web.Services;

public class Service{

[WebMethod()]public String getText(int index){

.

.

.

sysis interactive simulations aG

Create Proxy Class

§ webserviceutil /c:proxy /pa:downloaded.sdl/l:CSharp /n:XYZNameSpace§ csc /out:bin\XYZNameSpace.dll /t:library

/r:system.web.services.dll/r:system.xml.serialization.dll XYZNameSpace.cs

sysis interactive simulations aG

Sun‘s Answers to Web Services

§ EJBs, CORBA, RMI?§ JINI?§ JXTA (P2P)?

sysis interactive simulations aG

Microsoft Visual Studio 7

sysis interactive simulations aG

Things to Bear in Mind

§ Microsoft had one of the fastest and mostreliable Java Virtual Machines§ IL Code is never interpreted§ Microsoft has an excellent high quality

Development Environment§ For the near future only on Windows§ Java is not open (source) or a standard (?)§ Is Java 1.3 bloated, resource-hungry and

unreliable?

sysis interactive simulations aG

Q & Ahttp://www.gotdotnet.com/

http://www.javausergroup.at/http://www.sysis.at/