SlideShare une entreprise Scribd logo
1  sur  81
Télécharger pour lire hors ligne
GWT 2.8.x - 3.0.x
The Java alternative to Javascript
Manolo Carrasco
+ManuelCarrascoMonino
@dodotis
About me
Agenda
● A little bit of context of Vaadin
● Spooky JS
● History of GWT
● Present of GWT
○ LTM projects
○ Modern web
● Is GWT dead
○ State of the Frontend
○ J2CL the future
FIGHT FOR SIMPLICITYthinking of U and I
- Vaadin is a development platform for web
applications that prioritizes ease of development
and uncompromised end user experience.
- The Vaadin platform consists of a comprehensive
set of web components, a Java web framework,
configurable themes, tools and a set of app
templates.
Vaadin
Architecture
Developer Space
Provided by Vaadin
JVM
Browser
Java Lang JVM
ecosystem
libs, IDEs ...
Developer space GWT vs Vaadin
Java Lang JVM
ecosystem
libs, IDEs ...
Scala, Groovy...
MillStone 3.0
IT Mill 4.0
IT Mill 5.0
2002
2007
2008
2018
2013
2009
Vaadin 6.0
Vaadin 7.0
2017
Vaadin 8.0
Vaadin 10
Vaadin: a 18y whisky
Next Generation Architecture
Spooky JavaScript
JS: What is the issue here?
idx might be a String
"0" == 0
"0" === 0
[] == []
[] == ![]
![]
+[]
2 == [2]
+[2]
[2] + ''
+([2] + '')
+[2,3]
+[2,3] + ''
'2' + 1
'2' - 1
'2' - - 1
+true
+false
true + true
parseInt(2)
parseInt('2')
parseInt('aaa')
parseInt(9999999999999999)
typeof NaN
0.1 + 0.2 == 0.3
'I am String' instanceof String
String('I am String') instanceof String
3 > 2
2 > 1
3 > 2 > 1
3 > 2 >= 1
1 < Number.MAX_VALUE
-1 < Number.MAX_VALUE
-1 < Number.MIN_VALUE
Number.MAX_VALUE
Number.MIN_VALUE
Math.max(1,2,3)
Math.min(1,2,3)
Math.max() > Math.min()
Math.max()
Math.min()
String instanceof String
Math instanceof Math
typeof null
null instanceof Object
JS: Crazy type conversion
GWT's mission is to radically improve the web experience
for users by enabling developers to use existing Java tools
to build no-compromise AJAX for any modern browser.
GWT Mision
A high-level language allows the Developer not to miss out
on low-level details and reuse existing ecosystem
GWT Productivity 2006
2006 Context
- Browsers
- No Debug tools
- IE6, FF 1.5, Safari 2, Opera 9, No Chrome
- Incipient CSS (No animations, No rounded …)
- No RIA, No SPI
- No Smartphones
- Low performance PCs (256Mb, Single Core ...)
- JavaScript
- ES-3, No Standard XHR, No DOM traversing
- No IDE. No Refactoring, No Tests, No Libraries, No packaging ...
- No Runtime (V8)
- Java 1.4, no generics, no annotations
2006 Context
- Compiling to JavaScript was not a thing
- GWT pioneered the idea.
- Then came: CoffeeScript, Dart, TypeScript, …
Advantages of a Compiler
Separate the maintainability of the code from the
effectiveness of the executable.
- The handwritten JS was verbose and slow
- The solution is not to look for conventions in the javascript code
written by hand, it is to create a level of separation so that both are
not compromised (maintainability, effectiveness).
Remove the bad parts while keeping the good stuff
Advantages in Compile Time
- Common errors are correctable at compile time and
not in execution time.
- Functionalities can be injected.
- Peculiarities / Hacks for each browser
- Assets bundling and compression
- Code Splitting and async loading
- Conversion and obfuscation server objects ↔ client
- Versioning, Minimisation
The basis of GWT
- The heart of GWT is the compiler, Java -> JavaScript
- Only supports a subset of the Java language
- The resulting code is JavaScript, single-threaded code.
- Creates a separated, obfuscated and optimised
JavaScript implementation for each supported browser.
- Takes into account browser specific features, bugs, issues and
performance optimizations
- But the toolkit has plenty of tools (dev, build, test, libs)
Innuvo
1.0.21
1.3.3 O.S
2005
2006
2007
2018
2010
2009
2.0 UIB OOPHM
2.1 MVP RF
2011
2.2 Designer
3.0 J2CL
GWT a 12y whisky
2012
Grid 2.4
2013
2.5 SDM
2017
2.8 J8 JSi E22014
2.6 J7
The present of GWT
GWT is Popular in the Java Web
2016
2012
Stable Platform
Reliable
Good Tools & Ecosystem
High Quality and Mature
Fast development cycles
For Big Teams & Big Projects
But
High Learning Curve
Outdated docs
Obsolete Stuff
↝ Generators
↝ Widgets, Elements, JSO
↝ RPC
↝ RF
↝ AutoBeans
↝ UiBinder
↝ JSNI
↝ Classic DevMode
↝ Ant
↝ Designer
Project Activity Deceleration
A project with few Contributors
Unmaintained libs
GWT spring react
Hard to Interact with JS
- Not Anymore
- JsInterop
- Elemental2
@JsType(isNative = true)
public abstract class JQuery {
@JsMethod(namespace=GLOBAL)
public native static JQuery $(String selector);
public native JQuery css(String prop, String val);
public native JQuery attr(String name, String val);
}
import static jquery.JQuery.$;
// ...
$("ul > li").css("color", "red").attr("data-level", "first");
Java
Java
Use native JsType to use any
existing JavaScript library.
Use it like JavaScript
JsInterop Consume
package foo;
@JsType
public class Bar {
public boolean bool = true;
public Bar() {}
public String foo() { return "Hello GWTCon!";}
}
var bar = new foo.Bar();
if (bar.bool) {
alert(bar.foo());
}
JavaScript
Expose your Object to
JavaScript world.
JavaScript can use your public
API of exposed Java objects.
Java
JsInterop Export
Elemental2 - new Browser API
public class SimpleApp {
public static void main(String[] args) {
window.addEventListener("load", evt -> install());
}
private static void install() {
final HTMLButtonElement button = (HTMLButtonElement) document.createElement("button");
button.textContent = "Click me";
button.addEventListener("click", evt1 -> {
button.parentNode.removeChild(button);
console.log("Button has been removed.");
});
document.body.appendChild(button);
}
}
Status of the current GWT
GWT 2.8.x
- Big Java artifacts (no split in modules)
- Stable & Long Term API Support
- No new Features planned
- Prepared for JS
- JsInterop
- Elemental2
- Large ecosystem
- 2.8 is stable and available for foreseeable future
Long Term Support Applications
LTS Apps
2.8.x is perfect for Long Term Apps
- Avoid legacy modules
- Most Widgets, RPC, RF, etc
- Design with UIBinder and CSS3
- Use J8 syntax, collapse browser permutations.
- Select good 3rd party libs
- Gwt-material, Gwt-bootstrap, Gwt-query
- Use JsInterop for json data or Resty-GWT
Good Practices for LTS apps in 2.8.x
GWT is PWA
Decorate the host page with CSS3
App Shell
GWT nature is SPI and RIA
App Like Iterations
GWT History Tokens
Linkable
HTTPS: simply works
GWT linkers: unique random names
Secure & Fresh Updates
Responsive UI
- Permutation per device
- Responsive UI libs
- GWT already have
- Code splitting
- Code removal
- Permutations
Fast Loading
Offline
GWT is client side -> Works Offline
- Use Responsive Widgets
Gwt-bootstrap
Gwt-material
Gwt-polymer-elements
Recipe 1 - Responsiveness
- Re-use UI Componens: JsInterop
- Easier development and sharing
- Lazy load components when needed
- Cache components for ever
- Use the platform: Elemental 2.0
- Thanks to JsInterop, to interact with platform is easy
- Use Elements instead of Widgets
- Not need of gwt wrap libraries
Recipe 2 - Fast loading
- Add a static Web App manifest
- Generate service-worker
- Disable old browsers:
<set-property name="user.agent" value="safari,gecko1_8" />
- Don’t use permutations:
<collapse-all-properties value="true" />
- Avoid random JS names
<add-linker name="sso" />
- Use the sw-precache CLI
Recipe 3 - Offline first
- Use out-of-the-box solutions
- PouchDB + CouchDB
- Gwt-pouchdb
- Vaadin-pouchdb (via gwt polymer)
- Firebase
- Gwt-firebase (xplatform)
- Polymerfire (via gwt polymer)
Recipe 4 - Data Offline
- Inbox
- G Suite
- Google Docs
- Google Flights
- Closure
- Vaadin Flow internals
How uses modern GWT
GWT Transition path for the
Future
The Near future of GWT
GWT 2.9.x
- Modular (split in small artifacts)
- Parts might be transferred to, or taken by the community
- Expect changes and new Features in API
- Removing browsers, jsni, moving namespaces, etc
- Replacing generators with Annotation Processors
- But maintaining backwards compatibility
- Prepared for the JavaScript wild
- Expect tools for sharing with GWT 3.0
2.9.x might be your Transition Path
- Use min set of modules, start with Core.gwt.xml
- Forget Classic Widgets and Element
- Replace classic DOM with Elemental2
- #useThePlatform as much as possible
- Check 3rd party modules not to import User.gwt.xml
- Design the UI using Js reusable widgets
- Web components (gwt-polymer)
- Html templates (elemento or polymer)
- Decouple business logic from UI
Best practices for the Transition
The Future of GWT
Frontend: State of the art
We are in the JavaScript Era
Popularity of Web Platforms
Huge ecosystem
Good dev tools in JS
JS also runs everywhere
How is GWT in this jungle
Lot of reactions, Is GWT Dead?
GWT reasons, not valid anymore
- For the Browser (2006)
- Huge diffs between vendors (IE6)
- memory limitations (256Kb RAM PCs)
- Related with JavaScript (2006)
- No way to debug JS
- No tooling for JS optimisation and obfuscation
- No way of modularising / managing dependencies
- No IDE. No Testing tools. Slow runtime.
- Java Specific (2006)
- Same language client/server
- More developers than JavaScript
- The Java Language is the strong Key of using GWT
GWT reasons nowadays
Embrace the JavaScript world
GWT 3.0 is for the frontend chaos
- New compiler and tooling
- J2CL
- Runtime JVM, Node or both?
- Build system bazel, maven, npm ?
- Big changes in API and emulated JRE
- Prepared for the platform
- JsInterop
- Elemental2
- Comes with a different DX paradigm
J2CL
Pronounced “Jackal”
Shares features with the GWT compiler
● JsInterop
● Java8
● Java standard library (JRE)
● Elemental2
J2CL
Source to source transpiler
- Takes Java 8 code as input and outputs readable ES6 with JsDoc
Closure style annotations
Transpiles one Java class at a time
Optimizations happen in Closure compiler
Code generation happen in Java annotation processors
Targeting modern Js features, blazing fast
Transpiler
@JsType
public class Hello {
public String message() {
return "GWTCon!";
}
public static String getMessage() {
return "Hello " + new Hello().message();
}
}
class Hello extends java_lang_Object {
/**
* @public
*/
constructor() {
super();
}
/**
* @return {?string}
* @public
*/
message() {
return "GWTCon!";
}
/**
* @return {?string}
* @public
*/
static getMessage() {
return "Hello " + new Hello().message();
}
};
J2CL - Sharing Code
Java JavaScriptJ2CL JavaScriptClosure
Optimized
JavaScript
J2CL + Closure → Optimisation
Two possible paths for J2CL
➔ Classic Java Development flow
◆ Java IDE
◆ Java dependency artifacts (.jar)
◆ Java Build tools mvn, gradle, j2cl, closure, linker
◆ JVM for server side and testing tools
➔ Just a transpiler to JavaScript
◆ Java IDE
◆ JS dependencies (.js)
◆ JS Build tools npm, closure-compiler-js
◆ node-js for server side
◆ JS testing tools
A java transpiler in the JS world
NODE
ECOSYSTE
M
npm,gulp,*.js
,
Java IDE
mvn, jar,
Java IDE
JVMJAVA NODE
npm, gulp,
*.js,
Java IDE
JAVA
Thanks
manolo@vaadin.com
+ManuelCarrascoMonino
@dodotis

Contenu connexe

Tendances

Building Rich Internet Applications Using Google Web Toolkit
Building Rich Internet Applications Using  Google Web ToolkitBuilding Rich Internet Applications Using  Google Web Toolkit
Building Rich Internet Applications Using Google Web Toolkit
rajivmordani
 
Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3
Nuxeo
 

Tendances (20)

Building Rich Internet Applications Using Google Web Toolkit
Building Rich Internet Applications Using  Google Web ToolkitBuilding Rich Internet Applications Using  Google Web Toolkit
Building Rich Internet Applications Using Google Web Toolkit
 
Gwt Presentation
Gwt PresentationGwt Presentation
Gwt Presentation
 
Best Practices - By Lofi Dewanto
Best Practices - By Lofi DewantoBest Practices - By Lofi Dewanto
Best Practices - By Lofi Dewanto
 
Gwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoGwt.Create Keynote San Francisco
Gwt.Create Keynote San Francisco
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
XWiki Aquarium Paris
XWiki Aquarium ParisXWiki Aquarium Paris
XWiki Aquarium Paris
 
Turducken - Divide and Conquer large GWT apps with multiple teams
Turducken - Divide and Conquer large GWT apps with multiple teamsTurducken - Divide and Conquer large GWT apps with multiple teams
Turducken - Divide and Conquer large GWT apps with multiple teams
 
Net Beans61 Ide
Net Beans61 IdeNet Beans61 Ide
Net Beans61 Ide
 
Web Components the best marriage for a PWA
Web Components the best marriage for a PWAWeb Components the best marriage for a PWA
Web Components the best marriage for a PWA
 
GWT Reloaded
GWT ReloadedGWT Reloaded
GWT Reloaded
 
Java EE 6 Aquarium Paris
Java EE 6 Aquarium ParisJava EE 6 Aquarium Paris
Java EE 6 Aquarium Paris
 
MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
JBoss EAP 7 & JDG 7 최신 기술 소개
JBoss EAP 7 & JDG 7 최신 기술 소개JBoss EAP 7 & JDG 7 최신 기술 소개
JBoss EAP 7 & JDG 7 최신 기술 소개
 
GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6
 
GWT – The Java Advantage
GWT – The Java AdvantageGWT – The Java Advantage
GWT – The Java Advantage
 
Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3Nuxeo WebEngine and GlassFish v3
Nuxeo WebEngine and GlassFish v3
 
The WebKit project
The WebKit projectThe WebKit project
The WebKit project
 
GWT + Gears : The browser is the platform
GWT + Gears : The browser is the platformGWT + Gears : The browser is the platform
GWT + Gears : The browser is the platform
 
Java 9 and Project Jigsaw
Java 9 and Project JigsawJava 9 and Project Jigsaw
Java 9 and Project Jigsaw
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 

Similaire à The Java alternative to Javascript

SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
Didier Girard
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programming
Dmitry Buzdin
 
Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)
Dmitry Buzdin
 

Similaire à The Java alternative to Javascript (20)

SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
GWT - AppDays - (25 aprile 2014, pordenone)
GWT - AppDays - (25 aprile 2014, pordenone)GWT - AppDays - (25 aprile 2014, pordenone)
GWT - AppDays - (25 aprile 2014, pordenone)
 
GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day
 
Gwt
GwtGwt
Gwt
 
Gwt kickoff - Alberto Mancini & Francesca Tosi
Gwt kickoff - Alberto Mancini & Francesca TosiGwt kickoff - Alberto Mancini & Francesca Tosi
Gwt kickoff - Alberto Mancini & Francesca Tosi
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programming
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 
GWT: Our Experiences
GWT: Our ExperiencesGWT: Our Experiences
GWT: Our Experiences
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Tools
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
 
01 java intro
01 java intro01 java intro
01 java intro
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
Node.js an Exectutive View
Node.js an Exectutive ViewNode.js an Exectutive View
Node.js an Exectutive View
 
HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)
 
Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)
 

Plus de Manuel Carrasco Moñino

Gwt seminario java_hispano_manolocarrasco
Gwt seminario java_hispano_manolocarrascoGwt seminario java_hispano_manolocarrasco
Gwt seminario java_hispano_manolocarrasco
Manuel Carrasco Moñino
 

Plus de Manuel Carrasco Moñino (18)

Building Components for Business Apps
Building Components for Business AppsBuilding Components for Business Apps
Building Components for Business Apps
 
Intro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsIntro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin Elements
 
Rock GWT UI's with Polymer Elements
Rock GWT UI's with Polymer ElementsRock GWT UI's with Polymer Elements
Rock GWT UI's with Polymer Elements
 
Introducing GWT Polymer (vaadin)
Introducing GWT Polymer (vaadin)Introducing GWT Polymer (vaadin)
Introducing GWT Polymer (vaadin)
 
Speed up your GWT coding with gQuery
Speed up your GWT coding with gQuerySpeed up your GWT coding with gQuery
Speed up your GWT coding with gQuery
 
Vaadin codemotion 2014
Vaadin codemotion 2014Vaadin codemotion 2014
Vaadin codemotion 2014
 
GwtQuery the perfect companion for GWT, GWT.create 2013
GwtQuery the perfect companion for GWT,  GWT.create 2013GwtQuery the perfect companion for GWT,  GWT.create 2013
GwtQuery the perfect companion for GWT, GWT.create 2013
 
Aprendiendo GWT
Aprendiendo GWTAprendiendo GWT
Aprendiendo GWT
 
GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
 
GWT: Why GWT, GQuery, and RequestFactory
GWT: Why GWT, GQuery, and RequestFactoryGWT: Why GWT, GQuery, and RequestFactory
GWT: Why GWT, GQuery, and RequestFactory
 
Mod security
Mod securityMod security
Mod security
 
Gwt IV -mvp
Gwt IV -mvpGwt IV -mvp
Gwt IV -mvp
 
Gwt III - Avanzado
Gwt III - AvanzadoGwt III - Avanzado
Gwt III - Avanzado
 
Gwt II - trabajando con gwt
Gwt II - trabajando con gwtGwt II - trabajando con gwt
Gwt II - trabajando con gwt
 
Gwt I - entendiendo gwt
Gwt I - entendiendo gwtGwt I - entendiendo gwt
Gwt I - entendiendo gwt
 
Seguridad en redes de computadores
Seguridad en redes de computadoresSeguridad en redes de computadores
Seguridad en redes de computadores
 
Gwt seminario java_hispano_manolocarrasco
Gwt seminario java_hispano_manolocarrascoGwt seminario java_hispano_manolocarrasco
Gwt seminario java_hispano_manolocarrasco
 

Dernier

Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
raffaeleoman
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
Kayode Fayemi
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
amilabibi1
 

Dernier (18)

Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 

The Java alternative to Javascript

  • 1. GWT 2.8.x - 3.0.x The Java alternative to Javascript Manolo Carrasco +ManuelCarrascoMonino @dodotis
  • 3. Agenda ● A little bit of context of Vaadin ● Spooky JS ● History of GWT ● Present of GWT ○ LTM projects ○ Modern web ● Is GWT dead ○ State of the Frontend ○ J2CL the future
  • 5. - Vaadin is a development platform for web applications that prioritizes ease of development and uncompromised end user experience. - The Vaadin platform consists of a comprehensive set of web components, a Java web framework, configurable themes, tools and a set of app templates. Vaadin
  • 7. Java Lang JVM ecosystem libs, IDEs ... Developer space GWT vs Vaadin Java Lang JVM ecosystem libs, IDEs ... Scala, Groovy...
  • 8. MillStone 3.0 IT Mill 4.0 IT Mill 5.0 2002 2007 2008 2018 2013 2009 Vaadin 6.0 Vaadin 7.0 2017 Vaadin 8.0 Vaadin 10 Vaadin: a 18y whisky
  • 11. JS: What is the issue here? idx might be a String
  • 12. "0" == 0 "0" === 0 [] == [] [] == ![] ![] +[] 2 == [2] +[2] [2] + '' +([2] + '') +[2,3] +[2,3] + '' '2' + 1 '2' - 1 '2' - - 1 +true +false true + true parseInt(2) parseInt('2') parseInt('aaa') parseInt(9999999999999999) typeof NaN 0.1 + 0.2 == 0.3 'I am String' instanceof String String('I am String') instanceof String 3 > 2 2 > 1 3 > 2 > 1 3 > 2 >= 1 1 < Number.MAX_VALUE -1 < Number.MAX_VALUE -1 < Number.MIN_VALUE Number.MAX_VALUE Number.MIN_VALUE Math.max(1,2,3) Math.min(1,2,3) Math.max() > Math.min() Math.max() Math.min() String instanceof String Math instanceof Math typeof null null instanceof Object JS: Crazy type conversion
  • 13.
  • 14. GWT's mission is to radically improve the web experience for users by enabling developers to use existing Java tools to build no-compromise AJAX for any modern browser. GWT Mision A high-level language allows the Developer not to miss out on low-level details and reuse existing ecosystem GWT Productivity 2006
  • 15. 2006 Context - Browsers - No Debug tools - IE6, FF 1.5, Safari 2, Opera 9, No Chrome - Incipient CSS (No animations, No rounded …) - No RIA, No SPI - No Smartphones - Low performance PCs (256Mb, Single Core ...) - JavaScript - ES-3, No Standard XHR, No DOM traversing - No IDE. No Refactoring, No Tests, No Libraries, No packaging ... - No Runtime (V8) - Java 1.4, no generics, no annotations
  • 16. 2006 Context - Compiling to JavaScript was not a thing - GWT pioneered the idea. - Then came: CoffeeScript, Dart, TypeScript, …
  • 17. Advantages of a Compiler Separate the maintainability of the code from the effectiveness of the executable. - The handwritten JS was verbose and slow - The solution is not to look for conventions in the javascript code written by hand, it is to create a level of separation so that both are not compromised (maintainability, effectiveness). Remove the bad parts while keeping the good stuff
  • 18. Advantages in Compile Time - Common errors are correctable at compile time and not in execution time. - Functionalities can be injected. - Peculiarities / Hacks for each browser - Assets bundling and compression - Code Splitting and async loading - Conversion and obfuscation server objects ↔ client - Versioning, Minimisation
  • 19. The basis of GWT - The heart of GWT is the compiler, Java -> JavaScript - Only supports a subset of the Java language - The resulting code is JavaScript, single-threaded code. - Creates a separated, obfuscated and optimised JavaScript implementation for each supported browser. - Takes into account browser specific features, bugs, issues and performance optimizations - But the toolkit has plenty of tools (dev, build, test, libs)
  • 20. Innuvo 1.0.21 1.3.3 O.S 2005 2006 2007 2018 2010 2009 2.0 UIB OOPHM 2.1 MVP RF 2011 2.2 Designer 3.0 J2CL GWT a 12y whisky 2012 Grid 2.4 2013 2.5 SDM 2017 2.8 J8 JSi E22014 2.6 J7
  • 22. GWT is Popular in the Java Web 2016 2012
  • 25. Good Tools & Ecosystem
  • 28. For Big Teams & Big Projects
  • 29. But
  • 32. Obsolete Stuff ↝ Generators ↝ Widgets, Elements, JSO ↝ RPC ↝ RF ↝ AutoBeans ↝ UiBinder ↝ JSNI ↝ Classic DevMode ↝ Ant ↝ Designer
  • 34. A project with few Contributors
  • 36. Hard to Interact with JS - Not Anymore - JsInterop - Elemental2
  • 37. @JsType(isNative = true) public abstract class JQuery { @JsMethod(namespace=GLOBAL) public native static JQuery $(String selector); public native JQuery css(String prop, String val); public native JQuery attr(String name, String val); } import static jquery.JQuery.$; // ... $("ul > li").css("color", "red").attr("data-level", "first"); Java Java Use native JsType to use any existing JavaScript library. Use it like JavaScript JsInterop Consume
  • 38. package foo; @JsType public class Bar { public boolean bool = true; public Bar() {} public String foo() { return "Hello GWTCon!";} } var bar = new foo.Bar(); if (bar.bool) { alert(bar.foo()); } JavaScript Expose your Object to JavaScript world. JavaScript can use your public API of exposed Java objects. Java JsInterop Export
  • 39. Elemental2 - new Browser API public class SimpleApp { public static void main(String[] args) { window.addEventListener("load", evt -> install()); } private static void install() { final HTMLButtonElement button = (HTMLButtonElement) document.createElement("button"); button.textContent = "Click me"; button.addEventListener("click", evt1 -> { button.parentNode.removeChild(button); console.log("Button has been removed."); }); document.body.appendChild(button); } }
  • 40. Status of the current GWT GWT 2.8.x - Big Java artifacts (no split in modules) - Stable & Long Term API Support - No new Features planned - Prepared for JS - JsInterop - Elemental2 - Large ecosystem - 2.8 is stable and available for foreseeable future
  • 41. Long Term Support Applications LTS Apps
  • 42. 2.8.x is perfect for Long Term Apps
  • 43. - Avoid legacy modules - Most Widgets, RPC, RF, etc - Design with UIBinder and CSS3 - Use J8 syntax, collapse browser permutations. - Select good 3rd party libs - Gwt-material, Gwt-bootstrap, Gwt-query - Use JsInterop for json data or Resty-GWT Good Practices for LTS apps in 2.8.x
  • 45. Decorate the host page with CSS3 App Shell
  • 46. GWT nature is SPI and RIA App Like Iterations
  • 48. HTTPS: simply works GWT linkers: unique random names Secure & Fresh Updates
  • 49. Responsive UI - Permutation per device - Responsive UI libs
  • 50. - GWT already have - Code splitting - Code removal - Permutations Fast Loading
  • 51. Offline GWT is client side -> Works Offline
  • 52. - Use Responsive Widgets Gwt-bootstrap Gwt-material Gwt-polymer-elements Recipe 1 - Responsiveness
  • 53. - Re-use UI Componens: JsInterop - Easier development and sharing - Lazy load components when needed - Cache components for ever - Use the platform: Elemental 2.0 - Thanks to JsInterop, to interact with platform is easy - Use Elements instead of Widgets - Not need of gwt wrap libraries Recipe 2 - Fast loading
  • 54. - Add a static Web App manifest - Generate service-worker - Disable old browsers: <set-property name="user.agent" value="safari,gecko1_8" /> - Don’t use permutations: <collapse-all-properties value="true" /> - Avoid random JS names <add-linker name="sso" /> - Use the sw-precache CLI Recipe 3 - Offline first
  • 55. - Use out-of-the-box solutions - PouchDB + CouchDB - Gwt-pouchdb - Vaadin-pouchdb (via gwt polymer) - Firebase - Gwt-firebase (xplatform) - Polymerfire (via gwt polymer) Recipe 4 - Data Offline
  • 56. - Inbox - G Suite - Google Docs - Google Flights - Closure - Vaadin Flow internals How uses modern GWT
  • 57. GWT Transition path for the Future
  • 58. The Near future of GWT GWT 2.9.x - Modular (split in small artifacts) - Parts might be transferred to, or taken by the community - Expect changes and new Features in API - Removing browsers, jsni, moving namespaces, etc - Replacing generators with Annotation Processors - But maintaining backwards compatibility - Prepared for the JavaScript wild - Expect tools for sharing with GWT 3.0
  • 59. 2.9.x might be your Transition Path
  • 60. - Use min set of modules, start with Core.gwt.xml - Forget Classic Widgets and Element - Replace classic DOM with Elemental2 - #useThePlatform as much as possible - Check 3rd party modules not to import User.gwt.xml - Design the UI using Js reusable widgets - Web components (gwt-polymer) - Html templates (elemento or polymer) - Decouple business logic from UI Best practices for the Transition
  • 63. We are in the JavaScript Era
  • 64. Popularity of Web Platforms
  • 66. Good dev tools in JS
  • 67. JS also runs everywhere
  • 68. How is GWT in this jungle
  • 69. Lot of reactions, Is GWT Dead?
  • 70. GWT reasons, not valid anymore - For the Browser (2006) - Huge diffs between vendors (IE6) - memory limitations (256Kb RAM PCs) - Related with JavaScript (2006) - No way to debug JS - No tooling for JS optimisation and obfuscation - No way of modularising / managing dependencies - No IDE. No Testing tools. Slow runtime. - Java Specific (2006) - Same language client/server - More developers than JavaScript
  • 71. - The Java Language is the strong Key of using GWT GWT reasons nowadays
  • 73. GWT 3.0 is for the frontend chaos - New compiler and tooling - J2CL - Runtime JVM, Node or both? - Build system bazel, maven, npm ? - Big changes in API and emulated JRE - Prepared for the platform - JsInterop - Elemental2 - Comes with a different DX paradigm
  • 74. J2CL Pronounced “Jackal” Shares features with the GWT compiler ● JsInterop ● Java8 ● Java standard library (JRE) ● Elemental2
  • 75. J2CL Source to source transpiler - Takes Java 8 code as input and outputs readable ES6 with JsDoc Closure style annotations Transpiles one Java class at a time Optimizations happen in Closure compiler Code generation happen in Java annotation processors Targeting modern Js features, blazing fast
  • 76. Transpiler @JsType public class Hello { public String message() { return "GWTCon!"; } public static String getMessage() { return "Hello " + new Hello().message(); } } class Hello extends java_lang_Object { /** * @public */ constructor() { super(); } /** * @return {?string} * @public */ message() { return "GWTCon!"; } /** * @return {?string} * @public */ static getMessage() { return "Hello " + new Hello().message(); } };
  • 77. J2CL - Sharing Code Java JavaScriptJ2CL JavaScriptClosure Optimized JavaScript
  • 78. J2CL + Closure → Optimisation
  • 79. Two possible paths for J2CL ➔ Classic Java Development flow ◆ Java IDE ◆ Java dependency artifacts (.jar) ◆ Java Build tools mvn, gradle, j2cl, closure, linker ◆ JVM for server side and testing tools ➔ Just a transpiler to JavaScript ◆ Java IDE ◆ JS dependencies (.js) ◆ JS Build tools npm, closure-compiler-js ◆ node-js for server side ◆ JS testing tools
  • 80. A java transpiler in the JS world NODE ECOSYSTE M npm,gulp,*.js , Java IDE mvn, jar, Java IDE JVMJAVA NODE npm, gulp, *.js, Java IDE JAVA