Davide Montesin's talk about "write java, run javascript: create enterprise html5 apps without “undefined” bugs" during the #SFScon14
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
write java, run javascript:
create enterprise html5 apps without "undefined" bugs
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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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 <[email protected]> - 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: