Girl Geek Dinner Zurich 21 Nov 2013

Liliana Nuño Silva, EPD Agile Software Engineer.

In collaboration with:

{Zurich}

From Java to JS at warp speed

Quiz:

What I was used to

•  Java •  JSP •  Hibernate •  Spring •  (very little)CSS and JavaScript •  and more...

What I had to learn

•  JavaScript (for real) •  AngularJS/Karma •  RequireJS •  NodeJS •  Jasmine •  CSS (for real) •  and

Fears

Java vs Javascript Java

+

Car

script

==

Pet +

JavaScript? Carpet

==

???

JS: The Good Parts vs Evil

The good parts: 150 pages

JS- The def guide: 1100 pages

This looks good, right? Comparisons in JS: •  • 

"" == "0" false == null

// false // false

Why did I want to run away? Comparisons in JS:

•  • 

0 == "0" 0 == ""

// true // true

Why did I want to run away? Comparisons in JS: •  • 

false == "0" " \t\r\n " == 0

// true // true wtf??

Table of truth(y)

Red → falsy Green → truthy

(ish??)

The equals sign Maths

Java

JavaScript

=

==

===



!=

!==

Takeaway: NEVER use neither == nor != in Javascript

Array + Array [] + [] --> ''

Object + Object [] + [] --> '' {} + {} --> NaN

Array + Object [] + [] --> '' {} + {} --> NaN [] + {} --> {}

Object + Array [] + [] --> '' {} + {} --> NaN [] + {} --> {} {} + [] --> 0

Javascript: the good parts

•  Runs everywhere •  Succeeded where Java with • 

its Java Applets failed. Less verbose

Callbacks: Java vs JavaScript class MyClass { public void someMethod(SomeCallback callback) { MyResult result = doSomething();

var myInstance = {}; myInstance.someMethod = function(someCallback) { var result = doSomething();

callback.reportResult(result);

someCallback(result);

} }

}

public interface SomeCallback {

...

void reportResult(MyResult result); myInstance.someMethod(function(result) {

}

doWhatMustBeDone(result);

... myInstance.someMethod(new SomeCallback() {

});

public void reportResult(MyResult result) { doWhatMustBeDone(result); } });

14 lines

8 lines

Powerful: Dynamic Objects if (!String.prototype.myOwnTrim) { String.prototype.myOwnTrim = function () { return this.replace(/^\s+|\s+$/g, ''); }; } ' pepe '.myOwnTrim(); --> 'pepe'

GirlGeekDinnerZurich from Java to Javascript at Warp Speed - Final ...

(very little)CSS and JavaScript. • and more... Page 4 of 21. GirlGeekDinnerZurich from Java to Javascript at Warp Speed - Final.pdf. GirlGeekDinnerZurich from ...

2MB Sizes 0 Downloads 119 Views

Recommend Documents

Javascript java pdf
Page 1 of 18. Assorted magazines true pdfmay 2015.Saint lou lou.54242420691 - Download Javascript java pdf.Himp3 apk.Idealismin the Knight's Tale. Despiteits glorified accounts ofthechivalrous lives of gentlemen, the KnightВs Tale proves to be moret

the warp drive.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect ...

UP TO SPEED
Tornado treasures returned through use of social media (Tullahoma News) ... List of Alabama Tornado Casualties ... Disaster Relief Agencies (list of agencies).

UP TO SPEED
and tornado watches hours in ... After tornadoes left over 300 dead in just a 24 hour period those across the country are now .... Volunteer Call Center is a 24/7.

Semantics of Asynchronous JavaScript - Research at Google
tive C++ runtime, others in the Node.js standard library. API bindings, and still others defined by the JavaScript ES6 promise language feature. These queues ...... the callbacks associated with any database request would be stored in the same workli

2017 high-speed-rail-in-ontario-final-report.pdf
Page 3 of 130. Whoops! There was a problem loading this page. 2017 high-speed-rail-in-ontario-final-report.pdf. 2017 high-speed-rail-in-ontario-final-report.pdf.

2017 high-speed-rail-in-ontario-final-report.pdf
... and delivery models; and seeking financial approvals. I wish to thank you and your colleagues for your cooperation throughout the mandate and wish. the Government well in delivering its bold commitment to create Canada's first High Speed Rail. se

EE241 Final Report Building High Speed Sense ...
compensation has become an ideal solution to improve sense amp performance. To correctly characterize speed of sense amp in this paper, response time is.

NASPH 2017 Culbertson (Final) From Modern Medical Science to the ...
Page 1 of 17. 1. From Modern Medical Science to the Art of Healing: Heidegger and Gadamer on the Critique of Modern Health Care. Carolyn Culbertson. Health care today presents us with one of the great ironies of our time. On the one hand,. health car

tiger-brain-warp-1996.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

High-Speed Channel Modeling with Deep ... - Research at Google
schemes and parallel computing to enhance the efficiency of electromagnetic solvers on model extraction [1]. There are also approaches to efficiently generate ...

at the speed of life xzibit.pdf
Try one of the apps below to open or edit this item. at the speed of life xzibit.pdf. at the speed of life xzibit.pdf. Open. Extract. Open with. Sign In. Main menu.

Gipfeli - High Speed Compression Algorithm - Research at Google
is boosted by using multi-core CPUs; Intel predicts a many-core era with ..... S. Borkar, “Platform 2015 : Intel processor and platform evolution for the next decade ...

Reading Skills and Speed Reading at UGA.pdf
Whoops! There was a problem loading more pages. Retrying... Reading Skills and Speed Reading at UGA.pdf. Reading Skills and Speed Reading at UGA.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying Reading Skills and Speed Reading at UGA.pdf

Business At The Speed Of Thought.pdf
Business Wordlist 101. Activities 102. Whoops! There was a problem loading this page. Business At The Speed Of Thought.pdf. Business At The Speed Of ...