The Evolution of Java

53
The Evolution of Java Fu Cheng

description

The evolution history of Java. What Java is good for? The rising of dynamic languages in JVM.

Transcript of The Evolution of Java

Page 1: The Evolution of Java

The Evolution of Java

Fu Cheng

Page 2: The Evolution of Java

Author of Understanding the Java 7 Author of 40+ technical articles on

Page 3: The Evolution of Java

We talk about ...

Page 4: The Evolution of Java

Java is …

A Programming Language

Just like C/C++, Ruby, Python and many others

Page 5: The Evolution of Java

Java is ...

A Programming Platform

Language + Libraries + VM

Page 6: The Evolution of Java

Java is ...Popular

Page 7: The Evolution of Java

Java is ...

http://en.wikipedia.org/wiki/History_of_programming_languages

Old - maybe not old enough

Page 8: The Evolution of Java

Java is ...

Object-Oriented

Nearly everything is a object

Page 9: The Evolution of Java

Java is ...Easy to learn

Page 10: The Evolution of Java

Java is ...(Maybe) too easy to learn

The Perils of JavaSchoolsby Joel Spolsky

Java is not, generally, a hard enoughprogramming language that it can be used to discriminate between great

programmers and mediocre programmers.

Page 11: The Evolution of Java

Java is …

JDK 1.0

1996 1997 1998 2004 20062000 2002 2011

JDK 1.1

J2SE 1.2

J2SE 1.3

J2SE 1.4

J2SE 5.0

Java SE 6

Java SE 7

http://en.wikipedia.org/wiki/Java_(programming_language)#Versions

Slowly evolving

Page 12: The Evolution of Java

Java has ...

Strong Platform Medium language

Weak core libraries

Page 13: The Evolution of Java

Popular Platform• Desktop

– 850M PCs, 2011• Mobile

– Android– Java ME

• Enterprise– LinkedIn– Ebay– Paypal– AOL– Alibaba– Netflix

http://w3techs.com/technologies/details/pl-java/all/all

Page 14: The Evolution of Java

JVM

• Shield applications from OS layer details– Threading using java.lang.Thread

• Provide runtime support for applications– Basic types and operators– Object model– Unicode support– Dynamic linkage– Garbage collection– Memory model– Access control

Page 15: The Evolution of Java

Java Language

• Static typed• Strict & rigid syntax

It's hard to say language X is better than language Y.

Use the right tool.

Page 16: The Evolution of Java

Java is good for ...

Big Teams Long-term projects

The key is maintainability.Code readabilityFind good developers

High-profile projects

Page 17: The Evolution of Java

Core Libraries

• Java core libraries are weak– Collections– IO– Date/Time

• Rely on communities– Apache Commons XXX

• Problems– Version conflicts– Jar hell– Dependency management

Page 18: The Evolution of Java

http://www.slideshare.net/vishnu/the-top-10-reasons-the-ruby-programming-language-sucks

The Top 10 Reasons The Ruby Programming Language Sucks -Matz

See Ruby

Page 19: The Evolution of Java

Why Java Succeeded

Page 20: The Evolution of Java

Compile Once, Run Anywhere

Java Source Code(.java)

Java Byte Code(.class)Compile

Java Compiler

JVM

Win *Nix Mac

Java Language Specification

JVM Specification

Run

Page 21: The Evolution of Java

Class loader

• Java's true invention• Load code from remote

and execute locally• Core technique behind J

ava Applet• Java applet boosted Jav

a’s spreading in dot com age

NASA World Wind applet

Page 22: The Evolution of Java

How Java Evolves

Page 23: The Evolution of Java

Java Community Process

OpenJDK

+

Page 24: The Evolution of Java

Java Community Process

Develop standard technical specifications for Java technology

Java Specification Request (JSR) - Changes to make

http://jcp.org/en/procedures/overview

Page 25: The Evolution of Java

MemberExecutive Committee

(EC)

- Individuals- Companies- Organizations

- Major stakeholders- Representative cross-section of the Java Community

JSRs

Game of big players

Eclipse FoundationHPIBMIntelNokiaOracleRed HatSAPTwitterand more ...

submit approve

Page 26: The Evolution of Java

OpenJDK

• Open-source implemenation of Java SE• Reference implementation of JCP JSRs• Base of other Java SE implementations• Oracle collaboration with Red Hat, IBM, Apple, and S

AP

Page 27: The Evolution of Java

What Happened Behind Java SE 7 JSR

JSR 336 JavaTM SE 7 Release Contents

Final Approval Ballot

http://jcp.org/en/jsr/results?id=5225

Page 28: The Evolution of Java

Those Voted 'Yes' Said ...

http://jcp.org/en/jsr/results?id=5225

Page 29: The Evolution of Java

Licensing Terms of TCK

• Technology Compatibility Kit (TCK) is used to test compatibility of Java implementation.

• Oracle only wants to license the use of TCK in the OpenJDK context

• Apache Software Foundation, Doug Lea and Tim Peierls resigned from JCP EC in protest over this issue.– Apache Harmony Project - retried already

Oracle ... has essentially turned the JCP into a rubber-stamp organization for Java SE 7

Alex Handy

Page 30: The Evolution of Java

Evolution Areas of Java

Productivity Performance Modularization

Page 31: The Evolution of Java

Productivity

Page 32: The Evolution of Java

Averaging over the lifetime of the project, a programmer spends about 10-20% of his time writing code, and most programmers write about 10-12 lines of code per day that goes into the final product, regardless of their skill level.

http://automagical.rationalmind.net/2010/08/17/some-lesser-known-truths-about-programming/

Page 33: The Evolution of Java

http://www.codinghorror.com/blog/2005/08/are-all-programming-languages-the-same.html

Lines of Code

Page 34: The Evolution of Java

Java is improving

• Java SE 5– Enhanced for loop

• Java SE 7– try-with-resources– Diamond operator

• Java SE 8– List & Map literals– Lambda expressions

Example of lambda expression

http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html

Page 35: The Evolution of Java

Performance

Page 36: The Evolution of Java

Java is NOT slow

Page 37: The Evolution of Java

Benchmark Result 1

http://blog.cfelde.com/2010/06/c-vs-java-performance/

Page 38: The Evolution of Java

Benchmark Result 2

http://readwrite.com/2011/06/06/cpp-go-java-scala-performance-benchmark

Page 39: The Evolution of Java

Most of the performance issues are caused by programming errors

•Bad algorithms•Careless memory usage•I/O operations•Threading issues, dead lock

Page 40: The Evolution of Java

Java is improving

• Performance was not good prior to Java 1.3• Performance improved since HotSpot was intr

oduced in Java 1.3• Each Java release has performance improvem

ents

JVM in OpenJDK = HotSpot + JRockit

Page 41: The Evolution of Java

Modularization

Page 42: The Evolution of Java

Why you need Swing library for an application server?

Project Jigsaw

Design and implement a standard module system for the Java SE platform, and to apply that system to the platform itself and to the JDK

http://openjdk.java.net/projects/jigsaw/

Page 43: The Evolution of Java

JVM Languages

Page 44: The Evolution of Java

Rise of Dynamic JVM Languages

And more ... https://en.wikipedia.org/wiki/List_of_JVM_languages

Page 45: The Evolution of Java

Source code Java byte code

JVM

CompileRun

JythonJRubyGroovyScalaClojure...

Page 46: The Evolution of Java

the Da Vinci Machine Project

Extend the JVM with first-class architectural support for languages other than Java, especially dynamic languages.

http://openjdk.java.net/projects/mlvm/

Page 47: The Evolution of Java

Meet 'invokedynamic'

• A new JVM instruction introduced in JSR 292 for Java SE 7

• Allow extremely fast dynamic invocation through method handles

• Improve performance of dynamic JVM languages

http://jcp.org/en/jsr/detail?id=292

Page 48: The Evolution of Java

Polyglot and poly-paradigm programming

Use the right language to solve problems in different components

http://polyglotprogramming.com/papers/PolyglotPolyParadigm.pdf

Core business logicAdmin tasks

Web development

Concurrent programming

Page 49: The Evolution of Java

What should Java developers do?

Page 50: The Evolution of Java

Learn more about Java platform

Learn more JVM internals, class loading, byte code spec, etc.

Page 51: The Evolution of Java

Keep an eye on Java language

Use new features and enhancements to increase productivity

Page 52: The Evolution of Java

Embrace dynamic JVM languages

Learn new dynamic JVM languages to make your life easier

Page 53: The Evolution of Java

Java may not be a good programming language

Java platform is a good platform to work on

It’s evolving slowly

AND

BUT