Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
(ARCHITECTING WEB APPLICATIONS WITHOUT
GWT-USER)
Beyond GWT 3.0 Panic
Cristiano Costantini
@cristcost
+CristianoCostantini
http://lnkdin.me/p/cristianocostantini
GWT and ServiceMix project: 

270K LoC, 5500 classes, more than 200 Maven modules
GWT MEET-UP 2015
“GWT 2.8 and Beyond”, by Ray Cromwell, Goktug Gokdogan
OK… WHAT DO WE
DO NOW?
STOP USING GWT?
No, I want to reuse Java in Web
Applications, mobile platforms and off-
course in the Java Backend
STOP USING GWT?
1st. remove GWT-User from dependencies
2nd. don’t use JSNI, use JsInterop
3rd. don’t use Widgets, use Polymer
4th. don’t u...
1st. remove GWT-User from dependencies
2nd. don’t use JSNI, use JsInterop
3rd. don’t use Widgets, use Polymer
4th. don’t u...
INTRODUCING WUnit
an example application to test our
survival strategy
INTRODUCING WUNIT
WUNIT IS A UNIT TEST FRAMEWORK FOR…
INTRODUCING WUNIT
WUNIT IS A UNIT TEST FRAMEWORK FOR…
INTRODUCING WUNIT
…WARHAMMER, THE GAME
Testing which “Unit” is the best is really slow
Testing needs throwing a lot of dice
Using the “Assault
Dice” app…
…solves only 

part of the problem
SO IT
CAME
WUnit
DEMO
MANUAL
DICE APP
WUNIT
0 12,5 25 37,5 50
BENCHMARK
(Minutes to test two units)
AT FIRST WUNIT IS BORN WITH THIS ARCHITECTURE
CONSOLE ENGINE MODEL
POJOJavaSystem.out
THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC
ENGINE
Java
This code is so much complex
(Warhammer rules are so) that...
THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC
ENGINE
Java
This code is so much complex
(Warhammer rules are so) that...
THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC
ENGINE
Java
This code is so much complex
(Warhammer rules are so) that...
THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC
ENGINE
Java
This code is so much complex
(Warhammer rules are so) that...
WUnit’s Engine is implemented in Java
Developed with strong TDD
(coverage is about 93.6%)
REUSE - REUSE - REUSE
AIM CROSS-PLATFORM
CONSOLE
ENGINE MODEL
POJOJava
System.out
WEB
ANDROID
GWT/j2cl
Android
iOS
j2objc
…AND THEN I WANTED TO TO BUILD
AN USER INTERFACE FOR WUNIT:
HOW DID I DID IT?
(Singular not available)
HOW TO USE GWT
AND NOT GWT-USER
(Experiments made with WUnit prototype)
ARCHITECTING WEB APPLICATIONS FOR REUSE
VIEW
INPUT
PRESENTER ENGINE MODEL
VIEW
OUTPUT
written with
POJO
written in (pure)
...
REMOVE GWT-USER FROM DEPENDENCIES
1st
…but it comes the first failure!
JsInterop annotations and EntryPoint interface are inside GWT-user.
REMOVE GWT-USER FROM ...
…but it comes the first failure!
JsInterop annotations and EntryPoint interface are inside GWT-user.
Then, just avoid usin...
…and avoid inheriting “User” module in your .gwt.xml
-- TO GWT STEERING COMMITTEE --
please create an independent library 

with EntryPoint and JsInterop interfaces
so we can ...
Polymer is cool!
Write the widgets in javascript
DON'T USE WIDGETS, USE POLYMER
2nd
…displays as a table’s row on the browser
The custom HTML element…
<wunit-dice>element
<wunit-dice>element
Aspect
<wunit-game>element
<wunit-game>element
Aspect
@JsType
USE JsInterop
3rd
@JsType
USE JsInterop
3rd
* Note: this WUnit prototype has used the OLD JsInterop annotations
HTMLHOSTPAGE
LINK FROM GWT TO HOST PAGE
LINK FROM GWT TO HOST PAGE
Fail! I had to use JSNI (but it is limited to invoking query selector from Java,
and it can be ...
OUTPUT
FROM JAVA TO POLYMER
ELEMENTS
VIEW
OUTPUT
Polymer
OUTPUT
FROM JAVA TO POLYMER
ELEMENTS
VIEW
OUTPUT
Polymer
INPUT
FROM POLYMER
ELEMENTS TO JAVA
Polymer
VIEW
INPUT
INPUT
FROM POLYMER
ELEMENTS TO JAVA
Polymer
VIEW
INPUT
DON'T USE IDE PLUGINS 4th
Unfortunately this solution does not works standalone…
I've hacked extensively the CodeServer
*
Unfortunately this solution does not works standalone…
I've hacked extensively the CodeServer
HACKS-HACKS-HACKS
*
<add-linker name="sso" />
FOCUS: SSO LINKER
<add-linker name="sso" />
FOCUS: SSO LINKER
-- TO GWT STEERING COMMITTEE --
please make Code Server more modular and reusable so we
can use it this approach without h...
This problem is not solved yet
(WUnit don't uses client-server communication)
Work in progress
It would be possible to imp...
-- TO GWT STEERING COMMITTEE --
please create an independent and modular library 

with the javaemul, so it can be extende...
CONCLUSIONS:
How much GWT-User have we used in WUnit?
How much GWT-User have we used in WUnit?
Instrument
for
coverage
How much GWT-User have we used in WUnit?
Compile,
including
gwt:compile
How much GWT-User have we used in WUnit?
Execute
JettyEmbeddedServer
(including Code Server)
How much GWT-User have we used in WUnit?
* Open and run the app 

(to trigger Code Server compilation)
How much GWT-User have we used in WUnit?
Generate
coverage
report
COVERAGE REPORT WUNIT
(GWT Compilation and Code Server execution)
+ SUPER SOURCES
+ SUPER SOURCES
J2CL ?
FUTURE:
Maven archetype or Template for this approach
https://github.com/codejuicer/gwt-slimmize
(release after some clean up and ...
Career Website:
https://www.thalesgroup.com/en/homepage/careers
Jobs info:
cv.risorseumane@thalesgroup.com
INTERESTED WORK...
THANKS
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
Upcoming SlideShare
Loading in …5
×

GWTcon 2015 - Beyond GWT 3.0 Panic

2,567 views

Published on

Architecting Web Applications without GWT-user

  • I'm not sure how long until J2CL will be available, but I've been having great luck with JSweet (http://www.jsweet.org/)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

GWTcon 2015 - Beyond GWT 3.0 Panic

  1. 1. (ARCHITECTING WEB APPLICATIONS WITHOUT GWT-USER) Beyond GWT 3.0 Panic
  2. 2. Cristiano Costantini @cristcost +CristianoCostantini http://lnkdin.me/p/cristianocostantini
  3. 3. GWT and ServiceMix project: 
 270K LoC, 5500 classes, more than 200 Maven modules
  4. 4. GWT MEET-UP 2015 “GWT 2.8 and Beyond”, by Ray Cromwell, Goktug Gokdogan
  5. 5. OK… WHAT DO WE DO NOW?
  6. 6. STOP USING GWT?
  7. 7. No, I want to reuse Java in Web Applications, mobile platforms and off- course in the Java Backend STOP USING GWT?
  8. 8. 1st. remove GWT-User from dependencies 2nd. don’t use JSNI, use JsInterop 3rd. don’t use Widgets, use Polymer 4th. don’t use IDE plugins* 5th. don’t use GWT RPC Experiments Checklist:
  9. 9. 1st. remove GWT-User from dependencies 2nd. don’t use JSNI, use JsInterop 3rd. don’t use Widgets, use Polymer 4th. don’t use IDE plugins* 5th. don’t use GWT RPC LET’S PUT IT INTO PRACTICE Experiments Checklist:
  10. 10. INTRODUCING WUnit an example application to test our survival strategy
  11. 11. INTRODUCING WUNIT
  12. 12. WUNIT IS A UNIT TEST FRAMEWORK FOR… INTRODUCING WUNIT
  13. 13. WUNIT IS A UNIT TEST FRAMEWORK FOR… INTRODUCING WUNIT …WARHAMMER, THE GAME
  14. 14. Testing which “Unit” is the best is really slow
  15. 15. Testing needs throwing a lot of dice
  16. 16. Using the “Assault Dice” app… …solves only 
 part of the problem
  17. 17. SO IT CAME WUnit
  18. 18. DEMO
  19. 19. MANUAL DICE APP WUNIT 0 12,5 25 37,5 50 BENCHMARK (Minutes to test two units)
  20. 20. AT FIRST WUNIT IS BORN WITH THIS ARCHITECTURE CONSOLE ENGINE MODEL POJOJavaSystem.out
  21. 21. THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC ENGINE Java This code is so much complex (Warhammer rules are so) that I wouldn’t attempt to write it without a full OOP language with solid development tools
  22. 22. THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC ENGINE Java This code is so much complex (Warhammer rules are so) that I wouldn’t attempt to write it without a full OOP language with solid development tools
  23. 23. THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC ENGINE Java This code is so much complex (Warhammer rules are so) that I wouldn’t attempt to write it without a full OOP language with solid development tools
  24. 24. THE VALUE OF USING JAVA TO IMPLEMENT THE GAME LOGIC ENGINE Java This code is so much complex (Warhammer rules are so) that I wouldn’t attempt to write it without a full OOP language with solid development tools
  25. 25. WUnit’s Engine is implemented in Java Developed with strong TDD (coverage is about 93.6%) REUSE - REUSE - REUSE
  26. 26. AIM CROSS-PLATFORM CONSOLE ENGINE MODEL POJOJava System.out WEB ANDROID GWT/j2cl Android iOS j2objc
  27. 27. …AND THEN I WANTED TO TO BUILD AN USER INTERFACE FOR WUNIT: HOW DID I DID IT? (Singular not available)
  28. 28. HOW TO USE GWT AND NOT GWT-USER (Experiments made with WUnit prototype)
  29. 29. ARCHITECTING WEB APPLICATIONS FOR REUSE VIEW INPUT PRESENTER ENGINE MODEL VIEW OUTPUT written with POJO written in (pure)
 Java written in GWT/JS written in Polymer Note: Engine and Model are compiled to Javascript and run on the browser thanks to javaemul !
  30. 30. REMOVE GWT-USER FROM DEPENDENCIES 1st
  31. 31. …but it comes the first failure! JsInterop annotations and EntryPoint interface are inside GWT-user. REMOVE GWT-USER FROM DEPENDENCIES 1st
  32. 32. …but it comes the first failure! JsInterop annotations and EntryPoint interface are inside GWT-user. Then, just avoid using anything else from GWT-user… REMOVE GWT-USER FROM DEPENDENCIES 1st
  33. 33. …and avoid inheriting “User” module in your .gwt.xml
  34. 34. -- TO GWT STEERING COMMITTEE -- please create an independent library 
 with EntryPoint and JsInterop interfaces so we can remove GWT-User from dependencies
  35. 35. Polymer is cool! Write the widgets in javascript DON'T USE WIDGETS, USE POLYMER 2nd
  36. 36. …displays as a table’s row on the browser The custom HTML element…
  37. 37. <wunit-dice>element
  38. 38. <wunit-dice>element Aspect
  39. 39. <wunit-game>element
  40. 40. <wunit-game>element Aspect
  41. 41. @JsType USE JsInterop 3rd
  42. 42. @JsType USE JsInterop 3rd * Note: this WUnit prototype has used the OLD JsInterop annotations
  43. 43. HTMLHOSTPAGE
  44. 44. LINK FROM GWT TO HOST PAGE
  45. 45. LINK FROM GWT TO HOST PAGE Fail! I had to use JSNI (but it is limited to invoking query selector from Java, and it can be rewritten with the new JsInterop)
  46. 46. OUTPUT FROM JAVA TO POLYMER ELEMENTS VIEW OUTPUT Polymer
  47. 47. OUTPUT FROM JAVA TO POLYMER ELEMENTS VIEW OUTPUT Polymer
  48. 48. INPUT FROM POLYMER ELEMENTS TO JAVA Polymer VIEW INPUT
  49. 49. INPUT FROM POLYMER ELEMENTS TO JAVA Polymer VIEW INPUT
  50. 50. DON'T USE IDE PLUGINS 4th
  51. 51. Unfortunately this solution does not works standalone… I've hacked extensively the CodeServer *
  52. 52. Unfortunately this solution does not works standalone… I've hacked extensively the CodeServer HACKS-HACKS-HACKS *
  53. 53. <add-linker name="sso" /> FOCUS: SSO LINKER
  54. 54. <add-linker name="sso" /> FOCUS: SSO LINKER
  55. 55. -- TO GWT STEERING COMMITTEE -- please make Code Server more modular and reusable so we can use it this approach without hacks
  56. 56. This problem is not solved yet (WUnit don't uses client-server communication) Work in progress It would be possible to implement a clean approach if GWT was supporting GSON or if the javaemul was supporting (a more rich subset of) Java Reflection DON'T USE GWT RPC 5th
  57. 57. -- TO GWT STEERING COMMITTEE -- please create an independent and modular library 
 with the javaemul, so it can be extended in a clean way
  58. 58. CONCLUSIONS:
  59. 59. How much GWT-User have we used in WUnit?
  60. 60. How much GWT-User have we used in WUnit? Instrument for coverage
  61. 61. How much GWT-User have we used in WUnit? Compile, including gwt:compile
  62. 62. How much GWT-User have we used in WUnit? Execute JettyEmbeddedServer (including Code Server)
  63. 63. How much GWT-User have we used in WUnit? * Open and run the app 
 (to trigger Code Server compilation)
  64. 64. How much GWT-User have we used in WUnit? Generate coverage report
  65. 65. COVERAGE REPORT WUNIT (GWT Compilation and Code Server execution)
  66. 66. + SUPER SOURCES
  67. 67. + SUPER SOURCES
  68. 68. J2CL ? FUTURE:
  69. 69. Maven archetype or Template for this approach https://github.com/codejuicer/gwt-slimmize (release after some clean up and official gwt 2.8.0)
  70. 70. Career Website: https://www.thalesgroup.com/en/homepage/careers Jobs info: cv.risorseumane@thalesgroup.com INTERESTED WORKING IN MY TEAM?
  71. 71. THANKS

×