comparing.net and java: the view from 2006 david chappell chappell & associates copyright ©...

52
Comparing .NET and Java: The View From 2006 David Chappell Chappell & Associates www.davidchappell.com Copyright © 2006 David Chappell

Upload: poppy-golden

Post on 24-Dec-2015

230 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Comparing .NET and Java:The View From 2006

David ChappellChappell & Associates

www.davidchappell.com

Copyright © 2006 David Chappell

Page 2: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Co

nta

inin

g a

nd

C

on

nec

tin

g L

og

icApplication Platforms Today

Def

inin

g

Lo

gic

Logic to LogicLogic to Web

Browser

Acc

essi

ng

D

ata Data

Access

Web Services

Binary Communicatio

n

Distributed Transactions, etc.

Queued Messaging

Usi

ng

L

og

ic

Web Browser Standalone Client

Objects

Remote Logic

Page 3: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

.NET Framework 2.0D

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

ASP.NET

Acc

essi

ng

D

ata

ASMX/ WSE

.NET Remoting

Enterprise Services

System. Messaging

Usi

ng

L

og

ic

C#/Visual Basic/etc.

ADO.NET

Browser Windows Forms Remote Logic

Page 4: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

J2EE 1.4D

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Servlets/Java Server Pages

(JSP)

Acc

essi

ng

D

ata

JDBC

JAX-RPC

Remote Method Invocation (RMI)

Enterprise JavaBeans (EJB)

Java Message Service (JMS)

Usi

ng

L

og

ic

Java

Browser Remote LogicStandalone Client

Page 5: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

How We Got HereThe Last Ten Years

JavaMicrosoft

1996 Java, Java VMWindows DNA- ASP, ADO, MTS

1999J2EE 1.0- JSP, JDBC, EJB

2002

.NET Framework 1.0-C#/VB.NET, CLR-ASP.NET, ADO.NET, Enterprise Services-ASMX

J2EE 1.4- JAX-RPC

2003

2005 .NET Framework 2.0

Key

Application server technologies

Languages

Web services

Page 6: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

What’s Next

Java EE 5, including:- Enterprise JavaBeans 3.0

- JAX-WS

- More . . .

Java Community Process (JCP)

The open source world, including:- Eclipse- Spring Framework- Hibernate- Much more . . .

Various processes

Open SOA (OSOA), including:- Service Component Architecture (SCA)

- Service Data Objects (SDO)

Open SOA Collaboration

.NET Framework 3.0, including:- Windows Workflow Foundation (WF)

- Windows Communication Foundation (WCF)

- More . . .

J2EE 1.4

.NET Framework 2.0

Page 7: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Application Platforms in 2008D

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Logic to Web Browser

Acc

essi

ng

D

ata Data

Access

Logic to Logic

Usi

ng

L

og

ic

Web Browser Standalone Client Remote Logic

Objects Workflows

If … Then …

Rules

If … Then …If … Then …

Page 8: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

.NET Framework 3.0D

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

ASP.NET

Acc

essi

ng

D

ata

Usi

ng

L

og

ic

Browser/AJAX/ XBAPs

Windows Presentation Foundation (WPF)

Remote Logic

ADO.NET

C#, VB, etc. Workflows

Windows Workflow Foundation (WF)

Rules

WF Rules Engine

Windows Communication Foundation (WCF)

Page 9: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Java EE 5D

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Acc

essi

ng

D

ata

Usi

ng

L

og

ic

Remote Logic

Java

JDBC Java Persistence

API (JPA)

Servlets/Java Server Pages

(JSP)JAX-WS

Remote Method Invocation (RMI)

Enterprise JavaBeans 3.0

Java Message Service (JMS)

Browser/AJAX

Workflows Rules

Standalone Client

Page 10: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Open SOAD

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Acc

essi

ng

D

ata

Usi

ng

L

og

ic

Remote Logic

Service Data Objects (SDO)

Java, C++, etc. Workflows

BPEL

Servlets/Java Server Pages (JSP)

Service Component Architecture (SCA)

Browser/AJAX Standalone Client

Rules

Page 11: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

What Will Succeed J2EE 1.4?Some Observations

“We’re moving away from slavish devotion to J2EE to a blended source model.”

– Bill Roth, Vice President, BEA

“Organizations should look elsewhere when considering new enterprise development and should plan for the eventual sunset of Java EE as an enterprise solution.”

– Burton Group, July 2006

Page 12: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

What Will Succeed J2EE 1.4?Divining the Future

Major J2EE vendors have announced plans to support both Java EE 5 and Open SOA– But they’re unhappy with Sun’s stewardship of

Java– Sun’s decision to open source Java should help

Going forward, a combination of Java EE 5 and Open SOA is likely to dominate

Page 13: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

A Plausible Successor to J2EE 1.4D

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Acc

essi

ng

D

ata

Usi

ng

L

og

ic

Remote Logic

Java Workflows Rules

BPEL Various

Servlets/Java Server Pages (JSP)

Service Component Architecture (SCA)

Browser/AJAX Swing/Eclipse Client

Service Data Objects (SDO)

Java Persistence API (JPA)

Page 14: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Defining Logic: A Closer LookD

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Acc

essi

ng

D

ata

Usi

ng

L

og

ic

Objects Workflows

If … Then …

Rules

If … Then …If … Then …

Page 15: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Defining Logic: Objects

The main .NET languages (C#/VB) and Java are advancing along similar paths, e.g.,– Both now have generics– Java has added annotations (analogous

to .NET’s attributes)

Both worlds are adding support for dynamic languages– .NET: CLR-based IronPython– Java: JVM-based Jython, Groovy, etc.

Page 16: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Defining Logic: Workflows

Workflow Engine

1) Execute first step

2) Execute second step

3) Execute next step . . .

Page 17: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Creating Workflow LogicTwo Approaches

A workflow language: Business Process Execution Language (BPEL)– An XML-based language for defining process logic– Originally created by Microsoft and IBM– Now owned by OASIS

Generalized activities: Windows Workflow Foundation (WF)– Each activity is defined as a class– Can also support BPEL with appropriate activities

Page 18: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

BPELExample Activities

sequence: executes one or more activities sequentially

flow: executes one or more activities in parallel

switch: executes one of several paths based on the value of a condition

while: executes a specified activity as long as a condition is true

invoke: calls a web service

receive: receives an incoming web service call

compensationHandler: defines a compensation handler

Page 19: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

BPELA Simplified Example (1)

<process>

...

<partnerLink name=“customer” ... />

...

<variables>

<variable name = incomingRequest … />

<variable name = customerInfo … />

</variables>

<sequence>

<receive partnerLink="customer"

variable=“incomingRequest“ />

Identifies a communication partner

Declares variables

Receives a message

Page 20: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

BPELA Simplified Example (2)

<assign>

<copy>

<from variable=“incomingRequest"

property="props:customerNumber"/>

<to variable=“customerInfo"

property="props:customerID"/>

</copy>

</assign>

...

</sequence>

</process>

Performs an assignment

Page 21: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Defining a Graphical Process NotationAn Aside

The Business Process Modeling Notation (BPMN) aims at defining a standard graphical notation for defining process logic– It’s owned by the Object Management Group

(OMG)

ReceiveInvoice

POFound?

Process PO

Send Payment

YesOK?

Yes

NoNo

Page 22: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

BPELIllustrating a Typical Implementation

BPEL Execution

Engine

WorkflowGraphical Process

Design Tool

RuntimeServices

Page 23: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Other Activities

BPEL 1.1 Library

Host Process

WFIllustrating Its Components

Base Activity Library (BAL)

Workflow

Runtime Engine

Runtime Services

Visual Studio 2005

WF Workflow Designer

Page 24: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

WFExample BAL Activities

Sequence: executes one or more activities sequentially

Parallel: executes one or more activities in parallel

IfElse: executes one of several paths based on the value of a condition

While: executes a specified activity as long as a condition is true

InvokeWebService: calls a web service

Compensate: defines a compensation handler

Page 25: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

PerspectiveBPEL and WF

BPEL – The standard allows some portability

• Although vendors typically add proprietary extensions to the language, e.g., for human workflow

– But it’s a rigid approach• And most developers don’t like XML-based languages

WF– It’s a more general, extensible approach

• Allowing creation of reusable activities

– But it’s a Windows-only technology• And learning to write effective WF workflows takes time

Page 26: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Defining Logic: Rules

A business rules engine (BRE) lets developers express rules in a standard way, then have them executed by a common engine

A business rules management system (BRMS) typically includes:– A BRE– Developer tools– Business analyst tools– Rules management tools

Page 27: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Rules in the .NET Framework 3.0

WF includes a basic rules engine– The engine can be used with a WF workflow or

separately

The WF rules engine targets developers– It’s not a full BRMS– The goal is to help developers more easily

create rule-based applications

Page 28: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Rules in Java EE/Open SOA

Vendors use a range of diverse rules engines– Including integration with third parties such as

ILOG

The Object Management Group is working on some standards for rules

Page 29: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

PerspectiveRules

Rules are becoming part of the standard development platform– Although business rules engines aren’t yet a

mainstream technology for developers

Expect changes here– Even Microsoft’s plans aren’t completely clear

Page 30: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Containing Logic: A Closer LookD

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Logic to LogicLogic to Web

Browser

Acc

essi

ng

D

ata

Usi

ng

L

og

ic

Page 31: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Containing and Connecting LogicLogic to Web Browsers

.NET Framework 3.0– ASP.NET 2.0

Java EE 5 and Open SOA:– Both use Servlets/JSPs– Java EE 5 also includes Java Server Faces (JSF)

• A JSP tag library implementing a model/view/controller (MVC) architecture for HTML interfaces

– Various open source options are also used, e.g., Struts

Page 32: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Containing and Connecting LogicLogic to Logic

Java EE 5 tries to improve the existing containers and communication mechanisms– With JAX-WS and EJB 3.0

.NET Framework 3.0 and Open SOA instead provide a new unified foundation– .NET Framework: WCF– Open SOA: SCA

Page 33: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Microsoft vs. EJBThe Last Ten Years

JavaMicrosoft

1996 MTS

1998EJB 1.0Session beansEntity beans

2000 COM+

EJB 2.0Session beansEntity beansMessage-driven beans

2001

Stateless session beans are analogous to MTS objects

New version of entity beans

Allowed communication via JMS

Enterprise Services2002

2006EJB 3.0Session beansMessage-driven beans

(Supplanted by WCF)

Provided a .NET wrapper around COM+

Entity beans replaced by JPA

Page 34: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Windows Communication FoundationAPI

ASMX & WSE .NET Remoting Enterprise ServicesSystem. MessagingAPI

Unifying CommunicationWCF

Applications

.NET Framework 2.0

MSMQSOAP & WS-* Remoting binary protocol

DCOMProtocol

OthersSOAP & WS-* WCF binary protocol

MSMQProtocol

Applications

.NET Framework 3.0

Page 35: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Service Component ArchitectureAPI

JAX-RPC Java RMI JMSAPI EJB

Applications

J2EE 1.4

Applications

Open SOA

OthersSOAP & WS-* RMI binary protocol

Queued messaging protocolsProtocol

Unifying CommunicationSCA

Queued messaging protocols

SOAP & WS-* RMI binary protocols

Protocol Various protocols

Page 36: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

An Example ServiceWCF

using System.ServiceModel;

[ServiceContract]

interface IAdder

{

[OperationContract]

int Add(int a, int b);

}

class Adder : IAdder

{

public int Add(int a, int b)

{

return a + b;

}

}

Indicates that this interface should be

exposed as a service

Indicates that this method should be exposed as an operation in this service

Page 37: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

An Example ServiceSCA (Java)

import org.osoa.sca.annotations.*

@Remotable

public interface IAdder

{

int Add(int a, int b);

}

public class Adder implements IAdder

{

public int Add(int a, int b)

{

return a + b;

}

}

Indicates that this interface should be

exposed as a remotely accessible service

Page 38: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Describing an Exposed Service WCF

...

<service type=“Adder,CalcApp">

<endpoint

contract=“IAdder,CalcApp"

binding=”basicHttpBinding”

address=

"http://www.qwickbank.com/calc/adder.svc"/>

</service>

...

Operations exposed by the service

How to communicate with the service

Where to find the service

Page 39: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Describing an Exposed ServiceSCA

...

<service name=“IAdder">

<interface.java interface=“services.calc.IAdder” />

<binding.ws port=

“http://www.qwickbank.com/calc#

wsdl.endpoint(IAdder/IAdderSOAP)” />

</service>

...

Operations exposed by the service

How to communicate with the service

Where to find the service

Page 40: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

More WCF/SCA Similarities

Both allow a service to maintain state between calls:– WCF: [ServiceContract(Session=true)] – SCA (Java): @Scope(“session”)

Both allow one-way methods:– WCF: [OperationContract(IsOneWay=true)]

– SCA (Java): @OneWay

Both allow bidirectional communication via callbacks

Page 41: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Composite

Component

Component

Illustrating Assembly: A CompositeSCA

Component

Service

X

Y

Z

Wire

Y

Reference

Z

Property

Client X

Page 42: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Describing a CompositeSCA

A <composite> XML element can specify:– The components in a composite– The services each component exposes– The references each component makes to other services– The wires that connect references to services– Any properties that can be set on this composite

Some things this allows:– Dependency injection, where SCA locates the matching

service for a component’s reference• Although how this is done isn’t specified

– Graphical tools for assembling an application’s components

Page 43: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

PerspectiveWCF and SCA

Problems addressed:– WCF: Implementing services and remote clients– SCA: Implementing services and remote/local clients;

defining composite assemblyLanguage support:– WCF: Any .NET language– SCA: Java, BPEL, C++, others

Availability:– WCF: Implementation available now– SCA: Specs in progress

• Various implementations, e.g., open source Tuscany, are also in progress

Page 44: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Accessing Data: A Closer LookD

efin

ing

L

og

icC

on

tain

ing

an

d

Co

nn

ecti

ng

Lo

gic

Acc

essi

ng

D

ata Data

Access

Usi

ng

L

og

ic

Page 45: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Data Access TechnologyThe Last Ten Years

Java EE Open SOAMicrosoft

1996 ADO

JDBCEJB 1.0 Entity Beans

1998

EJB 2.0 Entity beans2001

Java Persistence API (JPA)2006

JAXBService Data Objects (SDO)

ObjectSpaces (cancelled)2003

Java Data Objects (JDO)

System.XMLADO.NET2002 Key

Relational access

O/R mapping

XML mapping

Relational access and XML mapping

Supplants EJB Entity beans and JDO

Page 46: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Illustrating ADO.NET

.NET Framework

Data Provider

.NET Framework

Data Provider

XML Document

XML Document

Application

DBMS

DataSetSerialized DataSet

<XML … />

Tables

Page 47: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Illustrating SDO

.NET Framework

Data Provider

XML Document

XML Document

Application

DBMS

Serialized DataObjects

<XML … />

Data Access Service

Data Access Service

XML DocumentOther Data

Source

Data Access Service

Data Graph

DataObjects

JDBC

Page 48: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

PerspectiveData Access

Data access is a hard problem– Both camps have gone through many iterations– The Java world has placed more emphasis on

O/R mapping technology

Microsoft’s forthcoming Language Integrated Query (LINQ) introduces a new perspective– LINQ for SQL addresses O/R mapping– LINQ for XML allows access to XML documents– More . . .

Page 49: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

WCFService

A Projection for 2008A Mainstream .NET Framework Application

WF Workflow

ASP.NET AJAX

WCFService

LINQ

ADO.NET

Page 50: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Java SCAComponent

A Projection for 2008A Mainstream Java EE/Open SOA Application

JSP/AJAX

Java SCAComponent

BPEL SCA Component

SDO

JPA

Page 51: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

Summary

Both camps tend to move in similar directions– The platforms will remain functionally similar

The approaches sometimes differ in significant ways, however– There are pros and cons

Competition benefits everybody

Page 52: Comparing.NET and Java: The View From 2006 David Chappell Chappell & Associates  Copyright © 2006 David Chappell

About the Speaker

David Chappell is Principal of Chappell & Associates in San Francisco, California. David Chappell is Principal of Chappell & Associates in San Francisco, California. Through his speaking, writing, and consulting, he helps IT professionals Through his speaking, writing, and consulting, he helps IT professionals understand, use, and make better decisions about enterprise software.understand, use, and make better decisions about enterprise software.David has been the keynote speaker for dozens of conferences and events in the David has been the keynote speaker for dozens of conferences and events in the U.S., Europe, Asia, and Latin America. His popular seminars have been attended by U.S., Europe, Asia, and Latin America. His popular seminars have been attended by tens of thousands of developers, architects, and decision makers in forty countries. tens of thousands of developers, architects, and decision makers in forty countries. David’s books have been published in ten languages and used in courses at MIT, David’s books have been published in ten languages and used in courses at MIT, ETH Zurich, and many other universities. He is Series Editor for Addison-Wesley’s ETH Zurich, and many other universities. He is Series Editor for Addison-Wesley’s award-winning award-winning Independent Technology GuidesIndependent Technology Guides, and he has been a regular , and he has been a regular columnist for several publications. In his consulting practice, David has helped columnist for several publications. In his consulting practice, David has helped clients such as Hewlett-Packard, IBM, Microsoft, Stanford University, and Target clients such as Hewlett-Packard, IBM, Microsoft, Stanford University, and Target Corporation adopt new technologies, market new products, train their sales staffs, Corporation adopt new technologies, market new products, train their sales staffs, and create business plans.and create business plans.David’s comments have appeared in The New York Times, CNN.com, and various David’s comments have appeared in The New York Times, CNN.com, and various other publications. Earlier in his career, he wrote software for supercomputers, other publications. Earlier in his career, he wrote software for supercomputers, chaired a U.S. national standardization working group, and played keyboards with chaired a U.S. national standardization working group, and played keyboards with the Peabody-award-winning Children’s Radio Theater. David holds a B.S. in the Peabody-award-winning Children’s Radio Theater. David holds a B.S. in Economics and an M.S. in Computer Science, both from the University of Economics and an M.S. in Computer Science, both from the University of Wisconsin-Madison.Wisconsin-Madison.