50
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Everything a Java EE Developer needs to know about the JavaScript Landscape

JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Embed Size (px)

Citation preview

Page 1: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Everything a Java EE Developer needs to know about the JavaScript Landscape

Page 2: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Geertjan Wielenga@geertjanw

Everything a Java EE Developer needs to know about the JavaScript Landscape

Page 3: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Geertjan Wielenga@geertjanw

Everything a Java Developer needs to know about the JavaScript Landscape

Page 4: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 4

Page 5: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Program Agenda• JavaScript is the assembly language of the web• Many, many, many libraries, frameworks, and tools

– Core libraries– Module systems– Build tools– Application frameworks– Testing frameworks– Component suites– Supporting tools

• Maybe we should forget about Java altogether?

Page 6: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Program Agenda• JavaScript is the assembly language of the web• Many, many, many libraries, frameworks, and tools

– Core libraries– Module systems– Build tools– Application frameworks– Testing frameworks– Component suites– Supporting tools

• Maybe we should forget about Java altogether?

Page 7: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

JavaScript is the assembly language of the web.

Page 8: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 9: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture's machine code instructions. Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple architectures, but require interpreting or compiling.

Wikipedia

Page 10: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

machine architecture: browser

machine language: JavaScript

Page 11: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Netscape – JavaScript

• In 1995, JavaScript started at Netscape• Java applets were cute – jumped on the bandwagon• License from Sun Microsystems to use “Java”• Uses a vaguely similar syntax• In reality, nothing like Java• Added JavaScript to the browser

Page 12: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

“JavaScript is the assembly language of the web.” – Scott Hanselman, 2011

Page 13: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

“I said 'JS is the x86 of the web' a couple ofyears ago but I can't claim it's original.

The point is JS is about as low as we can go.But it also has higher level facilities.”

– Brendan Eich (inventor of JavaScript)

Page 14: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 15: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

JavaScript is machine language for the browser.

Page 16: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Program Agenda• JavaScript is the assembly language of the web• Many, many, many libraries, frameworks, and tools

– Core libraries– Module systems– Build tools– Application frameworks– Testing frameworks– Component suites– Supporting tools

• Maybe we should forget about Java altogether?

Page 17: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Core Libraries

Page 18: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Module Systems

Build Tools

Page 19: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Application Frameworks

Page 20: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Comparison

Page 21: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Enterprises on AngularJShttp://blog.backand.com/are-enterprises-migrating-to-angularjs

● Google – DoubleClick

● ING – SpectINGular

● IBM – MobileFirst Platform Foundation

Page 22: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Demo

Page 23: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

New Kid On The Block...

Page 24: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 25: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

● Om – ClojureScript interface to React

● Mori – Persistent data structures

● Cortex – Centrally manage data

● Mercury – Module system

● Mithril – Similar framework

Page 26: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

WONTA

Page 27: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Write Once, Run Anywhere

Write Once, Never Touch Again

Page 28: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Testing Frameworks

Page 29: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Module SuitesData grids, menus, sliders, and other widgets.

Page 30: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Supporting Tools

Page 31: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Program Agenda• JavaScript is the assembly language of the web• Many, many, many libraries, frameworks, and tools

– Core libraries– Module systems– Build tools– Application frameworks– Testing frameworks– Component suites– Supporting tools

• Maybe we should forget about Java altogether?

Page 32: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Maybe we should forget about Java altogether?

Page 33: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Transpilers

https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS

Page 34: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Benefits of Transpilers

• Use a “better” (different, more familiar) language• Make use of different language features• Integrate with JavaScript landscape• Same language on frontend and backend

Page 35: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Transpilers

• CoffeeScript• TypeScript• Dart• GWT, Errai, Vaadin• DukeScript

Page 36: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

CoffeeScript

Page 37: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

CoffeeScript

Page 38: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

CoffeeScript

• Classes, Inheritance, and Super• Lexical Scoping and Variable Safety• String Interpolation• Block Strings and Block Comments• Golden Rule: “It's Just JavaScript”

Page 39: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

TypeScript

Page 40: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

TypeScript

• Superset of JavaScript• Optionally typed• Declaration files can apply types to existing libraries• Type inference• Modules• Generics• Mixins

Page 41: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Dart

Page 42: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Dart

• Optionally typed• Functions• Interfaces• Mixins• Libraries• Generics

Page 43: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Dart

• Metadata (annotations)• Integration with AngularJS• Integration with Polymer• Transpiles to JavaScript or the Dart VM• Run in Dartium, special build of Chromium• Maintained by Google

Page 44: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

GWT, Errai, Vaadin

• Google Web Toolkit• Compiler from Java to JavaScript• Tons of other features

– Build applications– Facilities for doing REST– UI components

• Errai: communications framework on GWT• Vaadin: component framework on GWT

Page 45: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

DukeScript

• Framework for creating cross-platform mobile, desktop and web applications.

• Plain Java applications that internally use HTML5 technologies and JavaScript for rendering.

• Write clean Java code and leverage the latest developments in modern UI technology.

Page 46: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

DukeScript

Page 47: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

DukeScript

Page 48: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

DukeScript

Page 49: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Demo

Page 50: JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScript Landscape - Geertjan Wielenga

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

JavaScript is the assembly language for modern web applications.

The browser is the target platform.

Either write JavaScriptor write Java and transpile to JavaScriptor stick to traditional server-side approach.

Choose wisely.

Conclusions