java™: what can it do and where is it going?

30
http://w3.ibm.com/ibm/presentations 9/1/2004 Java™: What can it do and where is it going? Andy Brodie

Upload: kyros

Post on 09-Jan-2016

41 views

Category:

Documents


1 download

DESCRIPTION

Java™: What can it do and where is it going?. Andy Brodie. Title slide. Presentation Contents. What is Java? Java and XML Java and Web Services The Future. What is Java?. Sectional slide. The Java Language. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Java™: What can it do and where is it going?

9/1/2004

Java™: What can it do and where is it going?

Andy Brodie

Page 2: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 2

Presentation Contents

What is Java?

Java and XML

Java and Web Services

The Future

Page 3: Java™: What can it do and where is it going?

9/1/2004

What is Java?

Page 4: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 4

The Java Language

“The Java™ programming language is a general-purpose, concurrent, class-based, object-oriented language “ – Java Language Specification

Provides many features of object orientation technology.

Largely copies the C syntax

int main(int argc, char **argv) {

for (int i=0; i<argc; i++) { printf(“%s\n”,argv[i]);

}

public static void main(String[] args){

for (int i=0; i<args.length; i++) { System.out.print(args[i] + “\n”);

}

Page 5: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 5

Java is not C++…

Java does not have:Pointers … well… almost…

Operator Overloading.

Goto.

Structs or unions.

Multiple Inheritance.

Templates.

Automatic Type conversion.

#typedefs, #define, or #anything!

Default arguments.

No explicit in-lining

C++ does not have:Garbage collection.

Arrays as first class objects and bounds checking.

Built in program documentation (javadoc).

A single “root” object, from which all others inherit.

A dedicated immutable “String” type.

Primitive type size consistency.

Automatically nulled variables.

Built-in concurrency.

Page 6: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 6

The different types of Java

Java™ 2 Platform, Micro Edition (J2ME)For consumer electronics and embedded devices.

Java™ 2 Platform, Standard Edition (J2SE)“Normal” Java

Java™ 2 Platform, Enterprise Edition (J2EE)An extension to J2SE that provides:

Rapid development and deployment of enterprise applications.

Covers Security, Transactions, Distribution

Containers supplying runtime support for J2EE application components.

Encourages 3-tier architectures with separation of business and display logic.

Page 7: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 7

A Brief History of Java

1990 – James Gosling, Patrick Naughton and Mike Sheridan start project Oak.

1996 –Java SDK 1.0 Released (first commercial)

1997 – Java SDK 1.1 Released

1998 – Java 2 Language Released (1.2

2000 – J2SE SDK 1.3

2002 – J2SE SDK 1.4

2004 – J2SE 5.0 Released (J2SE SDK 5.0)

202

1524

1840

2724

3278

477

0 1000 2000 3000 4000

1.0.2

1.1

1.2

1.3

1.4

1.5

Ja

va

Ve

rsio

n

Number of Classes

Page 8: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 8

The Java Virtual Machine (JVM)

Java source is compiled in to byte code.

Byte code executes on the Java Virtual Machine (JVM).Platform independent execution environment that abstracts operating

system specifics from the developer/user.

The byte code is interpreted by the JVM at runtime.

(Similar to Pascal’s PCode.)

The Just In Time (JIT) compiler converts Java bytes codes into native machine code for quicker execution.

Allows Java performance to be comparable to C++.

The JVM forms a “sandbox” to execute applications.

Page 9: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 9

Operating System

The Sandbox

A term often banded around to describe Java applications and applet environments.

Consists of 3 parts:The byte code verifier – stops “bad” programs from executing

The class loader – loads code in to memory.

The security manager – polices the executing code.

JVM

SecurityManager

Class Loader

ByteCodeVerifier

Application

Page 10: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 10

How multi-platform is J2SE?

Java is often touted as “multi-platform”, but how many platforms have JREs or JDKs?

Windows IA-32

IBM NUMA-Q

Windows IA-64

AIX/PPC32

AIX/PPC64

Linux IA32

Linux IA64

HP-UX

Linux/S390

Linux S/390 64

OS/2

Solaris

zOS

I5/OS

Linux IA32

Linux IA64

Solaris x86

Solaris SPARC

Windows IA32

Windows IA64

Mac OS X Mac OS Classic

Irix

Page 11: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 11

Enforcing J2SE compatibility

Sun licenses the Java Compatibility Kit (JCK) to J2SE vendors

Latest version contains 45,194 individual tests.Up from Java 2 JCK which had 27,309.

Why do you need the JCK?Without a successful pass you cannot call it Java or use the Java logo.

Page 12: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 12

How many J2EE licensees are there?

Apache Software Foundation

ATGBEA Systems

Borland Group

Caucho Technology Inc.

Data Direct Technologies

Fujitsu

HP

Hitachi

IBM

IONA Technologies

IronFlare

JBoss Group

Kingdee Middleware

Macromedia

NEC Nokia

Novell (Silverstream)

ObjectWeb

Oracle Corporation

Pramati

SAP

SAS Institute, Inc.

SeeBeyondSonic Software Corporation

SpiritSoft

Sun Microsystems

Sybase, Inc.

TIBCO Software Inc.

Tmax Soft

Trifork Technologies

webMethods

32 at last count…

Page 13: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 13

J2EE Compatibility

In the same way that Sun controls the use of the Java logo.J2EE implementations must pass a compatibility suite.

There are compliant implementations of J2EE 1.4 from:IBM - WebSphere Application Server Technology for Developers v6.0

JBoss – JBoss Application Server (open source)

Oracle – Oracle application Server Containers for J2EE 10g

Sun – Sun Java System Application Server Platform Edition 8

TMax Soft – JEUS 5.0

Trifork – Trifork T4 Application Server

Page 14: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 14

Who “controls” Java?

Sun has ultimate control of Java.

The Java Community Process – http://www.jcp.orgProduce Java Specification Requests (JSRs) determine future direction of

the Java language and libraries.

338 JSRs have been produced so far.

Almost all new language features and standard libraries come via the JCP.

Participated in by Java licensees and vendors:Such as: IBM, Apple, BEA Systems, Compaq, HP, Novell,

Symantec, Wind River, Oracle and Silverstream

Page 15: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 15

Microsoft .NET and Java

Which is better?

The Equivalences

Java Platform .NET

Java Virtual Machine (JVM)

Common Language Runtime (CLR)

Byte Code Microsoft Intermediate Language (MSIL)

Swing Windows Forms

J2SE/J2EE .NET Framework class library

EJB COM+ Services

J2EE Server .NET Framework

JSP ASP.NET

JDBC ODBC

J2ME .NET Compact Framework

BOTH are here to stay.

.NET and Java platform provide some equivalent facilities, shown here

Can .NET and Java work together?Service-Oriented Architectures and Web

Services fit both .NET and J2EE.

The WS-I profiles promote interoperability between .NET and Java applications via Web Services.

The Web Service Interoperability Organization produces WS-I Profiles.

See http://www.ws-i.org.

Page 16: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 16

C# - The Closest Language to Java

C# bears more than a passing resemblance to Java.

However…The are plenty of pitfalls for the Java programmer to fall in to by expecting

C# to behave the same way as Java.

E.g. No checked exceptions, casting objects changes their behaviour

…and several for a C# programmer to fall in to by expecting Java to behave the same way as C#!

E.g. Switch statement fall-through and constructors with same name as enclosing type.

Page 17: Java™: What can it do and where is it going?

9/1/2004

Java and XML

Java provision for the processing of XML data.

Page 18: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 18

Java and XML

Java includes libraries specifically for XML document generation, parsing and transformation:

Java API for XML Parsing: JAXP

Supports DOM and SAX W3C standards for document parsing and representation.

TRansformation API for XML- TRAX

Supports the XSLT language for specifying transformations of XML.

Java API for XML Bindings – JAXB

Static and Dynamic generation Java classes based on XML.

Java API for XML-based Remote Procedure Calls – JAX-RPC

Invocation of methods on remote services using XML-based calls.

Page 19: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 19

JAXP Example: Parsing an XML document

Creating an document object model (DOM) of an XML document is easy:

DocumentBuilderFactory factory =

DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(new File(xmlInputFile));

From here you can read, edit and write out the document.

For large XML documents, there is Simple API for XML (SAX), that is an “event driven” way of reading a document.

Page 20: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 20

TRAX: Transforming XML documents

Transformations are done via the eXtensible Stylesheet Language Transformation (XSLT) specification.

Each stylesheet is an XML document that contains a mix of declarative and programmatic constructs to transform an XML document in to another (XML or plain text) document.

Java provides the TRAX API to apply stylesheets to XML documents.

Page 21: Java™: What can it do and where is it going?

9/1/2004

Java and Web Services

Page 22: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 22

What is a Web Service?

“A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.” – The W3C.

Helped to develop standards for web services…Invocation: Simple Object Access Protocol (SOAP)

Description: Web Service Definition Language (WSDL)

Location: Universal Description, Discovery and Integration Project (UDDI)

Transport: HyperText Transport Protocol (HTTP)

Page 23: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 23

Web Services, Java and J2EE

Web Services are gaining popularity and recognition as an important technology for the future of business computing.

Tools, specifications and libraries to make it easy to create, publish and invoke Web Services from within a Java environment.

See the Web Services Interoperability WS-I Basic Profile on http://www.ws-i.org.

Enabling inter-operability between Java and non-Java services.

Support for Web Services described in J2EE 1.4 SpecificationAlso JSR-109 - Web Services for J2EE, Version 1.0

J2EE 1.4 platform provides tools and libraries to facilitate the development and deployment of web services in a J2EE container.

Many vendors provide tooling to automatically generate WSDL and SOAP interfaces.

You don’t want to be writing XML by hand!For example: WebSphere Application Developer Studio (WSAD).

Page 24: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 24

Java API for XML-based Remote Procedure Calls(JAX-RPC)

Developed through JSR-101.

JAX-RPC 1.0 defines APIs and conventions for supporting XML based RPC in the Java platform.

JAX-RPC 1.1 adds support for the WS-I Basic Profile 1.0 to improve interoperability between JAX-RPC implementations and with services implemented using other technologies.

JAX-RPC is designed to keep the platform independence of Web Services and XML.

Describes a reversible mapping from WSDL 1.1 to JavaTarget namespaces can be mapped to and from Java packages

Port types can be mapped to and from Java classes

Operations can be mapped to and from methods

Etc.

Page 25: Java™: What can it do and where is it going?

9/1/2004

The Future

Where J2SE and J2EE are going

Page 26: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 26

J2SE 5.0

The product formerly known as J2SE 1.5, a.k.a. TigerVersion number changes as the language is changing, not just the supplied libraries.

Released Java 5 on September 30th 2004.

New language features:Annotations

Generic Types

Enumerated types

Automatic conversion between primitive and object types: “Autoboxing”

Memory Model

Variable arguments: “varargs”

Enhanced loop syntax

Static Imports

Over 8002 features, enhancements and bug fixes integrated in to J2SE 5.0.

Page 27: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 27

Some of the J2SE 5.0 features

Autoboxing:Automatic conversion between primitive types and their object equivalents.

Integer six = new Integer(5) + 1;

Enhanced loops:int myArray[] = new int[10];

int total;

for (i : myArray) { total += i; }

Annotations:Simple markers or data structures compiled in to class files.

Similar to javadoc tags, such as @deprecated.

@api public void doIt();

Page 28: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 28

J2SE 5.0 Language Features (cont.)

Generics (a.k.a. Parameterized Types) E.g. not just a set of objects, but a set of strings.

Collection content types can be enforced at the language level.

Simplifies code and improves robustness.

NOT C++ Templates!!

Enumerated TypesTrue type-safe enumerated types (unlike C).

Can use constants inside switch statements.

Static ImportsAllows usage of static constants and methods without needing to qualify.

import static com.xyz.ConstantsClass.*;

message.setReliability(MY_FINAL_VALUE);

Page 29: Java™: What can it do and where is it going?

Java: What is can do and where is it going?

Java: What can it do and where is it going? 29

Java 2 Enterprise Edition 1.5 (JSR-244) Theme is “Ease of Development”

J2EE often criticised for complexity….

… when it was specifically designed to make life easier!

Still in the very early stages, expert group is being formed.

What’s proposed for J2EE 1.5?Enterprise Javabeans 3.0 - JSR-220

Abolishes local and remote bean and home interfaces.Replaced by Java 5 annotations

JavaServer Faces - JSR-127A user interface (UI) framework for Java Web Applications.Emphasises the re-use aspects of UI components.

Web Services Metadata for the Java Platform (JSR-181)Uses annotations to declare how Java methods should be presented as Web Services.

Java APIs for XML Binding (JAXB) 2.0 (JSR-222)

Java API for XML based Remote Procedure Calls (JAX-RPC) 2.0 (JSR-224)

Standard Tag Library for Java Server Pages (JSTL) 1.1 (JSR-52)

Page 30: Java™: What can it do and where is it going?

9/1/2004

End.

Thank you for listening!