SlideShare ist ein Scribd-Unternehmen logo
1 von 63
Downloaden Sie, um offline zu lesen
write java, run javascript: 
create enterprise html5 apps without "undefined" bugs 
by Davide Montesin <d@vide.bz> 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 1 / 63
Who I am 
Self employed senior consultant, teacher, programmer in 
Bolzano/Bozen, Italy 
Java - Android - HTML5/Js/Css3 - XML - JSON - Database 
Open source - Linux 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 2 / 63
Javascript & browsers 
Javascript ... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 3 / 63
Javascript variable 
Declaring a variable 
var person = 'davide'; 
console.log(person); 
Output 
davide 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 4 / 63
Javascript dynamic typing :-( 
A variable can contain any value type during its life 
var person = 'davide'; // String 
console.log(person); 
person = 2; // Number 
console.log(person); 
person = {name: 'davide'} // Object 
console.log(person); 
person = ['davide']; // Array 
console.log(person); 
Output: 
davide 
2 
Object {name: "davide"} 
["davide"] 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 5 / 63
Javascript dynamic typing :-(( 
A typo 
Output: 
undefined 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 6 / 63
Javascript dynamic typing :-(( 
A typo 
"person.name" is an error but javascript does not stop the execution 
but declares implicitly a new attribute. A very bad bug! 
Webstorm IDE and "use strict" does not help in this case :-( 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 7 / 63
Javascript dynamic typing :-(((((( 
Variables can contain any value, IDEs can't be exact with suggestions 
In this case the method innerHTML makes no sense for a string 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 8 / 63
Javascript dynamic typing :-((((( 
API: a javascript developer often consults documentation 
or copy/paste from examples 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 9 / 63
Javascript dynamic typing :-((( 
function parameters: the number and type of parameters 
function sum(a, b) { return a + b } 
console.log(sum(1,2)); 
console.log(sum(1)); 
console.log(sum("1","2")); 
console.log(sum(1,2,3)); 
console.log(sum({},[])); 
Output: 
3 
NaN 
12 
3 
[object Object] 
javascript does not stop the execution :-( 
Wrong values are introduced into the execution flow. 
The evidence of a problem can occur later in another part of the code 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 10 / 63
Javascript dynamic typing :-(((((( 
making a typo, using the wrong number/type of parameters 
or other errors, can be very frustrating! 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 11 / 63
Javascript dynamic typing :-(((((( 
to catch a type or parameter error you need to execute 
the code step by step with a debugger or with console.log 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 12 / 63
Javascript dynamic typing :-(((((( 
Problems increase with the line of code 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 13 / 63
Agile software development 
#1 start with a small working software 
#2 add new working features using short iteration (weeks) 
#3 evaluate results with customer then go to #2 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 14 / 63
Javascript dynamic typing :-(((((( 
In an iteration API can be changed .i.e add a new required parameter 
to a function or rename/refactor the code 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 15 / 63
Javascript dynamic typing :-(((((( 
If you want rename or change the signature of a function 
you must remember/find all the parts where you have used the function 
Do you remember? After 6 months? 1 year? 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 16 / 63
Javascript dynamic typing :-(((((( 
You want rename person's print to printName (but not book.print) 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 17 / 63
Javascript dynamic typing :-(((((( 
Without var types, Webstorm can't undestand and makes a mistake 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 18 / 63
Javascript dynamic typing :-(((((( 
If you don't remember where you have used the function ... 
... the customer some weeks later ... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 19 / 63
Javascript dynamic typing :-(((((( 
after each change you must test the software again 
If you don't remember anymore, in the worst case you must test all again! 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 20 / 63
Javascript dynamic typing :-(((((( 
Or write test cases only to check typo, types and parameters 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 21 / 63
Java 
Java ... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 22 / 63
Java variable 
Declaring a variable 
String person = "davide"; 
System.out.println(person); 
Output 
davide 
Type of variable is mandatory 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 23 / 63
Java variable 
Do you don't know which type you must use? 
<ctrl+1+enter> the IDE thinks for you! WITHOUT errors/mistakes 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 24 / 63
Java static typing :-) 
A variable can contain only a type during its life 
During editing (not running) the ide informs of errors 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 25 / 63
Java static typing :-) 
A variable isn't automatically created if it contains a typo 
During editing (not running) the ide informs of errors 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 26 / 63
Java static typing :-) 
A variable can contain only a type, ide can EXACTLY list the methods 
During editing (not running) the ide informs of errors 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 27 / 63
Java 
API guides are not required 
You can use your second monitor for better things... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 28 / 63
Java 
Methods: all invalid calls are marked with errors 
During editing (not running) the ide informs of errors 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 29 / 63
Java 
How to find typo and methods wrong parameters? 
Easy: follow the red signs ... 
During editing (not running) the ide informs of errors 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 30 / 63
Java 
Thanks to types, eclipse can EXACTLY find the methods to rename 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 31 / 63
Agile 
Real case: in SASAbusHTML5 it finds all the screens that call a bus stop detail 
After a change in the stop details is enough to check the 5 screens: 
BusLinePanel, BusStationInRangeWidget, Favourite, BusStationPopup, 
MenuSearch 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 32 / 63
Agile 
If you make an incompatible change to a signature of a method the IDE 
can tell you the exact places where you must fix the problem manually 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 33 / 63
With java 
The IDE helps you during editing, before the customer ... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 34 / 63
I will convert 
GREAT! I will convert my software from javascript to java 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 35 / 63
When and how convert? 
When does it make sense to use java instead javascript? 
How? The browser can't understand java ... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 36 / 63
GWT Report 2013 
http://vaadin.com/gwt/report-2013 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 37 / 63
GWT Report 2013 
http://vaadin.com/gwt/report-2013 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 38 / 63
Conclusions: When Java, When Javascript 
When Java 
too much undefined errors with javascript 
you are afraid to change your javascript project 
your customers are angry 
structured (complex) project (> 5k LOC) 
intranet / internet web apps 
need of easier maintenance over time 
android, desktop and server 
using java tools: refactor, debug, junit, ... 
You can't anyway forget all about html5/css3/javascript 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 39 / 63
Conclusions: When Java, When Javascript 
When Javascript 
web sites animations, gallery, widgets 
small project, copy&paste of code from internet 
not much custom development 
full control of javascript code needed: integration 
need of dinamic features that java does not support 
SEO not required 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 40 / 63
How 
Google Web Toolkit (GWT) (production) 
Micro Javascript Jvm (DMJsJvm) (experimental) 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 41 / 63
GWT - http://www.gwtproject.org 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 42 / 63
How does GWT works? 
GWT translates Java SOURCE code into the equivalent Javascript code 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 43 / 63
GWT: client, server, shared and serialization 
In a GWT project Java objects can run 
server only: this code will run only the server side: i.e. servlets 
client only: this code will run only the client side: i.e. Window, 
Location 
shared: this code can run both server or client side 
this data objects can be serialized and transmitted over the 
network from one side to the other (i.e. bus stops) 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 44 / 63
Should I learn new API? 
Should I learn new API? 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 45 / 63
Yes/No 
Yes, if you use gwt widgets 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 46 / 63
Yes/No 
GWT visual designer 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 47 / 63
Yes/No 
No, if you prefer you can mimic html5/javascript api (with java) 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 48 / 63
Yes/No 
With gwt you are open to use any existing javascript and css framework 
It is very easy to mix javascript and java 
There exist already a lot of wrapper projects 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 49 / 63
Yes/No 
With gwt you can use any css framework by simply setting the right class 
element.setClassName("btn btn-default"); 
Bootstrap, flat-ui, ecc ... 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 50 / 63
My GWT projects 
Projects I made with GWT 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 51 / 63
SASAbus HTML5 
HTML5 web app 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 52 / 63
SASAbus HTML5 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 53 / 63
The power of UI inherintance and composition 
Java UI components/object in the SASAbus HTML5 app 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 54 / 63
SASAbus Android 
Hybrid native + html5 (java + java) 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 55 / 63
SASAsightsee 
Which POI do you want to see? I give you the bus route! 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 56 / 63
DMJsJvm 
DMJsJvm: micro javascript jvm 
The easiest way to convert java to javascript 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 57 / 63
DMJsJvm 
Very small project: about 5k line of code 
Good to learn how a jvm works i.e. students 
Partial support for java 8 lambda 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 58 / 63
DMJsJvm 
DMJsJvm translates bytecode instead of java source code 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 59 / 63
DMJsJvm 
Why DMJsJvm is so small? 
Because the jvm is a very simple machine based on only a stack and 256 
instructions 
The bigger part are the system libraries ... I have replaced them with the 
equivalent calls to javascript 
DMJsJvm intentionally support only a part of jre 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 60 / 63
Java and the javascript bytecode 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 61 / 63
DMJsJvm 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 62 / 63
Thanks 
Thank you! 
(C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 63 / 63

Weitere ähnliche Inhalte

Was ist angesagt?

Guice tutorial
Guice tutorialGuice tutorial
Guice tutorial
Anh Quân
 

Was ist angesagt? (20)

Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Mock test rad 2
Mock test rad 2Mock test rad 2
Mock test rad 2
 
Visage Android Hands-on Lab
Visage Android Hands-on LabVisage Android Hands-on Lab
Visage Android Hands-on Lab
 
Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a Monolith
 
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Language
 
TypeScript, Dart, CoffeeScript and JavaScript Comparison
TypeScript, Dart, CoffeeScript and JavaScript ComparisonTypeScript, Dart, CoffeeScript and JavaScript Comparison
TypeScript, Dart, CoffeeScript and JavaScript Comparison
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
 
Enabling Lean at Enterprise Scale: Lean Engineering in Action
Enabling Lean at Enterprise Scale: Lean Engineering in ActionEnabling Lean at Enterprise Scale: Lean Engineering in Action
Enabling Lean at Enterprise Scale: Lean Engineering in Action
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
Dart on Arm - Flutter Bangalore June 2021
Dart on Arm - Flutter Bangalore June 2021Dart on Arm - Flutter Bangalore June 2021
Dart on Arm - Flutter Bangalore June 2021
 
The WebView Role in Hybrid Applications
The WebView Role in Hybrid ApplicationsThe WebView Role in Hybrid Applications
The WebView Role in Hybrid Applications
 
[CLIW] Web testing
[CLIW] Web testing[CLIW] Web testing
[CLIW] Web testing
 
PRG 420 NERD Become Exceptional--prg420nerd.com
PRG 420 NERD Become Exceptional--prg420nerd.comPRG 420 NERD Become Exceptional--prg420nerd.com
PRG 420 NERD Become Exceptional--prg420nerd.com
 
Guice tutorial
Guice tutorialGuice tutorial
Guice tutorial
 
PRG 420 Effective Communication - snaptutorial.com
PRG 420 Effective Communication - snaptutorial.comPRG 420 Effective Communication - snaptutorial.com
PRG 420 Effective Communication - snaptutorial.com
 
CodeStock14: Hiding in Plain Sight
CodeStock14: Hiding in Plain SightCodeStock14: Hiding in Plain Sight
CodeStock14: Hiding in Plain Sight
 
PRG 420 NERD Education Counseling--prg420nerd.com
PRG 420 NERD Education Counseling--prg420nerd.comPRG 420 NERD Education Counseling--prg420nerd.com
PRG 420 NERD Education Counseling--prg420nerd.com
 

Ähnlich wie SFScon14: write java, run javascript: create enterprise html5 apps without “undefined” bugs

CV-Roy-Salha
CV-Roy-SalhaCV-Roy-Salha
CV-Roy-Salha
roy salha
 
Coded ui in a nutshell
Coded ui in a nutshellCoded ui in a nutshell
Coded ui in a nutshell
Omer Karpas
 

Ähnlich wie SFScon14: write java, run javascript: create enterprise html5 apps without “undefined” bugs (20)

PVS-Studio 7.25 release
PVS-Studio 7.25 releasePVS-Studio 7.25 release
PVS-Studio 7.25 release
 
SFScon18 - Davide Montesin - javascript await async no more callback headache
SFScon18 - Davide Montesin - javascript await async no more callback headache SFScon18 - Davide Montesin - javascript await async no more callback headache
SFScon18 - Davide Montesin - javascript await async no more callback headache
 
CV-Roy-Salha
CV-Roy-SalhaCV-Roy-Salha
CV-Roy-Salha
 
Getting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with ThymeleafGetting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with Thymeleaf
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene Groeschke
 
SFScon 21 - Davide Montesin - Typescript vs. Java
SFScon 21 - Davide Montesin - Typescript vs. JavaSFScon 21 - Davide Montesin - Typescript vs. Java
SFScon 21 - Davide Montesin - Typescript vs. Java
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
How to Improve Visual C++ 2017 Libraries Using PVS-Studio
How to Improve Visual C++ 2017 Libraries Using PVS-StudioHow to Improve Visual C++ 2017 Libraries Using PVS-Studio
How to Improve Visual C++ 2017 Libraries Using PVS-Studio
 
Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014
 
Coded ui in a nutshell
Coded ui in a nutshellCoded ui in a nutshell
Coded ui in a nutshell
 
Continuous Delivery with Spring Cloud Pipelines: Case study. - Lublin JUG
Continuous Delivery with Spring Cloud Pipelines: Case study. - Lublin JUGContinuous Delivery with Spring Cloud Pipelines: Case study. - Lublin JUG
Continuous Delivery with Spring Cloud Pipelines: Case study. - Lublin JUG
 
Steps to migrate vb6 application to vb dotnet
Steps to migrate vb6 application to vb dotnetSteps to migrate vb6 application to vb dotnet
Steps to migrate vb6 application to vb dotnet
 
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
 
VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment Preview
 
New Year PVS-Studio 6.00 Release: Scanning Roslyn
New Year PVS-Studio 6.00 Release: Scanning RoslynNew Year PVS-Studio 6.00 Release: Scanning Roslyn
New Year PVS-Studio 6.00 Release: Scanning Roslyn
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 libraries
 
Introduction to ASP.NET Using Visual Studio
Introduction to ASP.NET Using Visual StudioIntroduction to ASP.NET Using Visual Studio
Introduction to ASP.NET Using Visual Studio
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 

Mehr von South Tyrol Free Software Conference

SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...
SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...
SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...
South Tyrol Free Software Conference
 
SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...
SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...
SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...
South Tyrol Free Software Conference
 
SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...
SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...
SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...
South Tyrol Free Software Conference
 
SFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelines
SFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelinesSFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelines
SFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelines
South Tyrol Free Software Conference
 
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
South Tyrol Free Software Conference
 
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis MapsSFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
South Tyrol Free Software Conference
 

Mehr von South Tyrol Free Software Conference (20)

SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...
SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...
SFSCON23 - Rufai Omowunmi Balogun - SMODEX – a Python package for understandi...
 
SFSCON23 - Roberto Innocenti - From the design to reality is here the Communi...
SFSCON23 - Roberto Innocenti - From the design to reality is here the Communi...SFSCON23 - Roberto Innocenti - From the design to reality is here the Communi...
SFSCON23 - Roberto Innocenti - From the design to reality is here the Communi...
 
SFSCON23 - Martin Rabanser - Real-time aeroplane tracking and the Open Data Hub
SFSCON23 - Martin Rabanser - Real-time aeroplane tracking and the Open Data HubSFSCON23 - Martin Rabanser - Real-time aeroplane tracking and the Open Data Hub
SFSCON23 - Martin Rabanser - Real-time aeroplane tracking and the Open Data Hub
 
SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...
SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...
SFSCON23 - Marianna d'Atri Enrico Zanardo - How can Blockchain technologies i...
 
SFSCON23 - Lucas Lasota - The Future of Connectivity, Open Internet and Human...
SFSCON23 - Lucas Lasota - The Future of Connectivity, Open Internet and Human...SFSCON23 - Lucas Lasota - The Future of Connectivity, Open Internet and Human...
SFSCON23 - Lucas Lasota - The Future of Connectivity, Open Internet and Human...
 
SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...
SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...
SFSCON23 - Giovanni Giannotta - Intelligent Decision Support System for trace...
 
SFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelines
SFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelinesSFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelines
SFSCON23 - Elena Maines - Embracing CI/CD workflows for building ETL pipelines
 
SFSCON23 - Christian Busse - Free Software and Open Science
SFSCON23 - Christian Busse - Free Software and Open ScienceSFSCON23 - Christian Busse - Free Software and Open Science
SFSCON23 - Christian Busse - Free Software and Open Science
 
SFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
SFSCON23 - Charles H. Schulz - Why open digital infrastructure mattersSFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
SFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
 
SFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portal
SFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portalSFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portal
SFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portal
 
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
 
SFSCON23 - Stefan Mutschlechner - Smart Werke Meran
SFSCON23 - Stefan Mutschlechner - Smart Werke MeranSFSCON23 - Stefan Mutschlechner - Smart Werke Meran
SFSCON23 - Stefan Mutschlechner - Smart Werke Meran
 
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
 
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free softwareSFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
 
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
 
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changerSFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
 
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
 
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation InternetSFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
 
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis MapsSFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
 
SFSCON23 - Davide Vernassa - Empowering Insights Unveiling the latest innova...
SFSCON23 - Davide Vernassa - Empowering Insights  Unveiling the latest innova...SFSCON23 - Davide Vernassa - Empowering Insights  Unveiling the latest innova...
SFSCON23 - Davide Vernassa - Empowering Insights Unveiling the latest innova...
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

SFScon14: write java, run javascript: create enterprise html5 apps without “undefined” bugs

  • 1. write java, run javascript: create enterprise html5 apps without "undefined" bugs by Davide Montesin <d@vide.bz> (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 1 / 63
  • 2. Who I am Self employed senior consultant, teacher, programmer in Bolzano/Bozen, Italy Java - Android - HTML5/Js/Css3 - XML - JSON - Database Open source - Linux (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 2 / 63
  • 3. Javascript & browsers Javascript ... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 3 / 63
  • 4. Javascript variable Declaring a variable var person = 'davide'; console.log(person); Output davide (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 4 / 63
  • 5. Javascript dynamic typing :-( A variable can contain any value type during its life var person = 'davide'; // String console.log(person); person = 2; // Number console.log(person); person = {name: 'davide'} // Object console.log(person); person = ['davide']; // Array console.log(person); Output: davide 2 Object {name: "davide"} ["davide"] (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 5 / 63
  • 6. Javascript dynamic typing :-(( A typo Output: undefined (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 6 / 63
  • 7. Javascript dynamic typing :-(( A typo "person.name" is an error but javascript does not stop the execution but declares implicitly a new attribute. A very bad bug! Webstorm IDE and "use strict" does not help in this case :-( (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 7 / 63
  • 8. Javascript dynamic typing :-(((((( Variables can contain any value, IDEs can't be exact with suggestions In this case the method innerHTML makes no sense for a string (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 8 / 63
  • 9. Javascript dynamic typing :-((((( API: a javascript developer often consults documentation or copy/paste from examples (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 9 / 63
  • 10. Javascript dynamic typing :-((( function parameters: the number and type of parameters function sum(a, b) { return a + b } console.log(sum(1,2)); console.log(sum(1)); console.log(sum("1","2")); console.log(sum(1,2,3)); console.log(sum({},[])); Output: 3 NaN 12 3 [object Object] javascript does not stop the execution :-( Wrong values are introduced into the execution flow. The evidence of a problem can occur later in another part of the code (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 10 / 63
  • 11. Javascript dynamic typing :-(((((( making a typo, using the wrong number/type of parameters or other errors, can be very frustrating! (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 11 / 63
  • 12. Javascript dynamic typing :-(((((( to catch a type or parameter error you need to execute the code step by step with a debugger or with console.log (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 12 / 63
  • 13. Javascript dynamic typing :-(((((( Problems increase with the line of code (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 13 / 63
  • 14. Agile software development #1 start with a small working software #2 add new working features using short iteration (weeks) #3 evaluate results with customer then go to #2 (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 14 / 63
  • 15. Javascript dynamic typing :-(((((( In an iteration API can be changed .i.e add a new required parameter to a function or rename/refactor the code (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 15 / 63
  • 16. Javascript dynamic typing :-(((((( If you want rename or change the signature of a function you must remember/find all the parts where you have used the function Do you remember? After 6 months? 1 year? (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 16 / 63
  • 17. Javascript dynamic typing :-(((((( You want rename person's print to printName (but not book.print) (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 17 / 63
  • 18. Javascript dynamic typing :-(((((( Without var types, Webstorm can't undestand and makes a mistake (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 18 / 63
  • 19. Javascript dynamic typing :-(((((( If you don't remember where you have used the function ... ... the customer some weeks later ... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 19 / 63
  • 20. Javascript dynamic typing :-(((((( after each change you must test the software again If you don't remember anymore, in the worst case you must test all again! (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 20 / 63
  • 21. Javascript dynamic typing :-(((((( Or write test cases only to check typo, types and parameters (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 21 / 63
  • 22. Java Java ... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 22 / 63
  • 23. Java variable Declaring a variable String person = "davide"; System.out.println(person); Output davide Type of variable is mandatory (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 23 / 63
  • 24. Java variable Do you don't know which type you must use? <ctrl+1+enter> the IDE thinks for you! WITHOUT errors/mistakes (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 24 / 63
  • 25. Java static typing :-) A variable can contain only a type during its life During editing (not running) the ide informs of errors (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 25 / 63
  • 26. Java static typing :-) A variable isn't automatically created if it contains a typo During editing (not running) the ide informs of errors (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 26 / 63
  • 27. Java static typing :-) A variable can contain only a type, ide can EXACTLY list the methods During editing (not running) the ide informs of errors (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 27 / 63
  • 28. Java API guides are not required You can use your second monitor for better things... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 28 / 63
  • 29. Java Methods: all invalid calls are marked with errors During editing (not running) the ide informs of errors (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 29 / 63
  • 30. Java How to find typo and methods wrong parameters? Easy: follow the red signs ... During editing (not running) the ide informs of errors (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 30 / 63
  • 31. Java Thanks to types, eclipse can EXACTLY find the methods to rename (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 31 / 63
  • 32. Agile Real case: in SASAbusHTML5 it finds all the screens that call a bus stop detail After a change in the stop details is enough to check the 5 screens: BusLinePanel, BusStationInRangeWidget, Favourite, BusStationPopup, MenuSearch (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 32 / 63
  • 33. Agile If you make an incompatible change to a signature of a method the IDE can tell you the exact places where you must fix the problem manually (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 33 / 63
  • 34. With java The IDE helps you during editing, before the customer ... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 34 / 63
  • 35. I will convert GREAT! I will convert my software from javascript to java (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 35 / 63
  • 36. When and how convert? When does it make sense to use java instead javascript? How? The browser can't understand java ... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 36 / 63
  • 37. GWT Report 2013 http://vaadin.com/gwt/report-2013 (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 37 / 63
  • 38. GWT Report 2013 http://vaadin.com/gwt/report-2013 (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 38 / 63
  • 39. Conclusions: When Java, When Javascript When Java too much undefined errors with javascript you are afraid to change your javascript project your customers are angry structured (complex) project (> 5k LOC) intranet / internet web apps need of easier maintenance over time android, desktop and server using java tools: refactor, debug, junit, ... You can't anyway forget all about html5/css3/javascript (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 39 / 63
  • 40. Conclusions: When Java, When Javascript When Javascript web sites animations, gallery, widgets small project, copy&paste of code from internet not much custom development full control of javascript code needed: integration need of dinamic features that java does not support SEO not required (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 40 / 63
  • 41. How Google Web Toolkit (GWT) (production) Micro Javascript Jvm (DMJsJvm) (experimental) (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 41 / 63
  • 42. GWT - http://www.gwtproject.org (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 42 / 63
  • 43. How does GWT works? GWT translates Java SOURCE code into the equivalent Javascript code (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 43 / 63
  • 44. GWT: client, server, shared and serialization In a GWT project Java objects can run server only: this code will run only the server side: i.e. servlets client only: this code will run only the client side: i.e. Window, Location shared: this code can run both server or client side this data objects can be serialized and transmitted over the network from one side to the other (i.e. bus stops) (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 44 / 63
  • 45. Should I learn new API? Should I learn new API? (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 45 / 63
  • 46. Yes/No Yes, if you use gwt widgets (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 46 / 63
  • 47. Yes/No GWT visual designer (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 47 / 63
  • 48. Yes/No No, if you prefer you can mimic html5/javascript api (with java) (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 48 / 63
  • 49. Yes/No With gwt you are open to use any existing javascript and css framework It is very easy to mix javascript and java There exist already a lot of wrapper projects (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 49 / 63
  • 50. Yes/No With gwt you can use any css framework by simply setting the right class element.setClassName("btn btn-default"); Bootstrap, flat-ui, ecc ... (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 50 / 63
  • 51. My GWT projects Projects I made with GWT (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 51 / 63
  • 52. SASAbus HTML5 HTML5 web app (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 52 / 63
  • 53. SASAbus HTML5 (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 53 / 63
  • 54. The power of UI inherintance and composition Java UI components/object in the SASAbus HTML5 app (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 54 / 63
  • 55. SASAbus Android Hybrid native + html5 (java + java) (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 55 / 63
  • 56. SASAsightsee Which POI do you want to see? I give you the bus route! (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 56 / 63
  • 57. DMJsJvm DMJsJvm: micro javascript jvm The easiest way to convert java to javascript (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 57 / 63
  • 58. DMJsJvm Very small project: about 5k line of code Good to learn how a jvm works i.e. students Partial support for java 8 lambda (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 58 / 63
  • 59. DMJsJvm DMJsJvm translates bytecode instead of java source code (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 59 / 63
  • 60. DMJsJvm Why DMJsJvm is so small? Because the jvm is a very simple machine based on only a stack and 256 instructions The bigger part are the system libraries ... I have replaced them with the equivalent calls to javascript DMJsJvm intentionally support only a part of jre (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 60 / 63
  • 61. Java and the javascript bytecode (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 61 / 63
  • 62. DMJsJvm (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 62 / 63
  • 63. Thanks Thank you! (C) 2013-2014 Davide Montesin <d@vide.bz> - License: CC BY NC ND write java, run javascript: create enterprise html5 apps without "undefined" bugs 63 / 63