SlideShare une entreprise Scribd logo
1  sur  43
Dart 
The better Javascript ? 
Jorg Janke 
jorg@accorto.com 
Slides link: 
http://bizfabrik.com 
October 2014
Structure 
● Why Dart? 
● Example 
● Dart Language 
● Dart Tooling 
● Questions 
The goal of Dart is "ultimately to 
replace JavaScript as the lingua 
franca of web development on 
the open web platform”
Where are you coming from? 
● Java 
o GWT 
o Servlet, JSP, JSF, .. 
● .Net 
o Typescript 
● PHP, Python, Ruby, … 
● Mobile Native 
● Javascript 
Front-end 
Technology
Who is Jorg Janke? 
● Education: MBA 
(Accounting), IT 
● Jobs 
o ADV/Orga 
o Unisys - Prod.Mgr 
o Oracle - Dir Apps 
o Self employed since 
1999 
● Experience 
o Mainframe, Unix, Linux 
o Algol, PL/I, SmallTalk 
o Oracle DBA 
o Java since 1.1 
o Dart since 1.0 
● Founder: Compiere 
o Open Source ERP
What is Dart 
● OO/Functional Programming Language 
o Executed in Dartium (Chrome) 
o Generating Javascript Executable dart2js 
● Created/Maintained by Google 
● ECMA-408 Standard 
o http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf 
● Targeting Client + Server
Lot’s of good Dart Overviews 
Check 
● https://www.dartlang.org/ 
● Books ... 
● http://video.coldfrontconf.com/ 
why-google-thinks-you-should-drop 
I concentrate here on Developer experience
Dart - becoming popular 
● TIOBE Index - October 2014 
o #1: C 17% 
o #2: Java 14% 
o #3: Objective-C 10% - odd - a bit high 
o #4: C++ 4.8% 
o #10: JavaScript 1.7% - odd - a bit low 
o #17: Dart 1.1% 
o #25: ActionScript 0.6% 
o http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Why we picked 
Dart 
… not stayed with GWT
BizFabrik UI Requirements/Features 
● Mobile First 
o disconnected 
● 24/7 
o active for days 
● User 
o Expert/Guidance 
o Own Layout 
 switch 
o Analytics built in 
● Admin 
o Add/Change Tables/ 
Fields/Processes/ 
Validations/... 
● General 
o Dynamic Model 
Driven Architecture 
o Multi-Tenant/Locale 
o AWS/GAE/OnPremise
What we wanted to avoid 
● Multiple UIs - browser + naive(s) 
● Hard to Develop 
o Good IDE - Step through Debugging 
● Hard to Maintain (different code styles, …) .. in 5y 
o Developer Learning curve -- “Sonar” 
● Hard to Understand 
o Partners/Customers to extend 
● Fighting libraries - dependencies - conflicts
Alternatives evaluated 
● GWT (Used) 
o Easy Java Integration 
o Stable “mature” 
o Very good build process 
o A bit heavy 
o Lost in Translation (Java 
Structure <> JS features 
class <> prototypal) 
● JSP/JSF/… 
o Connected only 
● Coffeescript 
o Step in the right direction 
● Typescript 
o commitment? 
● Javascript “pure” 
o improved IDE support & 
tooling - JSLint 
o hard to build sizeable apps 
o too many different styles 
o no static analysis
BizFabrik Architecture 
● Java Backend 
o SOAP/REST 
● Dart 
o (Bootstrap css) 
o Grid/Form/.. 
o Gantt Graph (svg) 
● Communication 
o ? JSON (using Rest) 
● Protocol Buffers 
o binary (smaller than 
JSON, especially 
data rows) 
o fast (~ same 
de/serializing speed) 
o Data Transfer 
Objects (get/set..) 
o for many languages
Demo 
~ 1,400 kb compressed js
Grid Mode 
Built in Analytics/Data Visualization
User defined - switchable Layout 
Form Guidance Mode
Form Expert Mode 
Form|Grid 
Master/Detail/..
All UIs 
dynamically generated 
Customizable 
+ Dynamically Extendable 
(webhooks) 
Context dependent 
validation/visibility/layout 
(multiple levels) 
First dynamic MDA 
(Model Driven Architecture) 
Compiere ERP 
- 2000 Java Swing 
- 2007 GWT (1:1) 
Salesforce calls theirs 
MetaData Driven 
BizFabrik 
- redesigned from Scratch 
for Data Visualization of 
multiple DataSources 
- GWT 2012 
redesigned from Scratch 
- Dart 2014 (3 months)
Dart selection reasons 
● Good DOM 
(Polyfill) API 
● “Close to the metal” 
o eventually JS 
o Web Components, ... 
● Streams, Futures 
● Libraries 
● Type support 
No worry about 
Javascript: 
The Bad Parts 
new - this - null - falsiness - 
for (in) - ... 
Douglas Crockford
Static Typing increases Productivity 
● Static typing and 
Documentation 
o Dynamic Languages 
require Context 
switches 
● Source: Dr. A. Stefik, +An 
empirical study on the impact of static 
typing on software 
maintainabilityhttp://web.cs.unlv.edu/stefik 
a/Papers.php
Dart Environment 
Dart Language 
core, collection, 
async, io, isolate, math, 
mirrors, typed_data 
DOM API 
html, svg, indexed_db, 
web_gl/audio/sql 
Pub 
Build / Libs / 
Packages 
Logging 
Intl 
Route 
Polymer Distribution 
Angular Dart 
Protocol Buff 
IDE: 
- Dart 
- IntelliJ 
Plugins: 
- Sublime 
etc 
Version Control 
+ Dependencies 
Unittest
Dart IDE options 
Dart IDE 
● Scaled down old Eclipse 
version 
● Usability ++ 
o Starts very fast 
o Getting started 
● IDE Feature set -- 
o unstable with Dev Tools 
IntelliJ - Dart 
● works with minor itches 
Full Eclipse 
● not tried 
Chrome Dev Editor 
● early days 
Debugging in Dartium
Predefined Structure (Pub) 
● bin 
● doc 
● example 
● lib 
o lib.dart 
● test 
● tool 
● web 
o project.dart 
o project.html 
● pubspec.yaml 
● packages 
o in main directory 
o links: sub directories 
 /web /tool /test 
/bin /example 
 (not /lib) 
o allows “package/..” 
references anywhere 
copied into 
packages
Java Package => Libraries 
Java 
● Directory = package 
● File = class 
● FileName = className 
Dart 
● Directory, FileName 
does not matter... if you 
have good memory 
library libx; 
// part = code imports 
part “aa/bb/file.dart”; 
part of libx; 
class a{} 
class b{} 
aa/bb/file.dart
Java Converts: 
You are ultimately writing Javascript !!! 
Javascript: The Good Parts
Language Features 
● Cannot cover all 
o for complete details see dartlang.org 
● I like the most 
o single inheritance .. with mixins 
 intro to prototypal + functional programming 
● with a safety net 
o named parameters
Great! Optional / Named Parameters 
int f1 (int mandatory, {int optional: 2}) {..} 
use: 
f1(2); 
f1(2, optional: 3); 
int f2 (int mandatory, [int second = 2]) {..} 
use: 
f2(2); 
f2(1,2);
Named Constructors 
● MyClass(String this.p1, int this.i1) {} 
o saves the: this.p1 = p1; 
● MyClass.fromXml(String xml) {..} 
o No overloading - better documentation 
o alternative 
 static MyClass parse(String xml) {..}
Oohh well .. - no overloading 
workaround: 
String dump(dynamic param) { 
if (param is X1) return _dumpX1(param as X1); 
if (param is X2) return _dumpX2(param as X2); 
} 
String _dumpX1(X1 value) {..} 
String _dumpX2(X2 value) {..}
Async done nicely + future 
one many 
sync T 
Iterable<T> 
(..) {..} (..) sync* {..} 
async Future<T> Stream<T> 
await (..) async {..} (..) async* {..} 
main() async { startAnalytics() async { // 
doesn’t block 
.. await .. await 
analytics.loadLib(); 
}
Great! Function variables 
● Example 
o static int parse(String s, { int onError(String s)}); 
● Use 
o int xx=int.parse(“12”); 
o int xx=int.parse(“12”, onError: (String s) {return -1;}); 
o int xx=int.parse(“12”, onError: intErrorHandler); 
int intErrorHandler(String s) {return -1;} 
… if you are 
coming from 
Java7 
… this and Streams eliminate “callback hell”
Public - Internal - controlled 
class X { 
int public; 
int _internal; 
int get getter {..} 
void set setter (int value) {..} 
} 
Use: X xx = new X(); 
xx.public = 5; // r/w 
xx._internal = 5; // Library 
int z = xx.getter; 
xx.setter = 5; 
… a bit confusing at first when to use what: 
- function - isEmpty() 
- or attribute - isEmpty
Better Strings 
String s = ’’’Multiple 
Line 
String’’’; 
s = “String” “ in” “ parts”; 
s = ‘This “works” too’; 
s = r’raw string n’; 
s = “String with ${param}”; 
if (s.isEmpty) {} 
if (s.isNotEmpty) {} 
trivial, but I like it 
Java char <> 
CodeUnit|CharCode
Type Surprises (... coming from Java) 
bool initial = true; 
int active = 5; 
: 
int ms = initial ? 0 : 1000; 
if (active > 10) 
ms += (active/10) * 200; 
… compiles fine 
ms is an int - right?
Type Surprises (... coming from Java) 
bool initial = true; 
int active = 5; 
: 
int ms = initial ? 0 : 1000; 
if (active > 10) 
ms += (active/10) * 200; 
… compiles fine 
ms is an int - right? 
Runtime: 
● double 
Fix: 
ms += (active~/10) * 200; 
… compiler (analyzer) 
should catch that
Type Surprises - Lists 
int add(List<int> ints) {..} 
int x = add([1,”a”, 3]); 
List<O1> o1List = …; 
List<O2> o2List = …; 
for (O1 in o2List) {..} 
… compiles fine 
Runtime Error 
… compiler (analyser) 
should catch that
Libraries - Pub 
Core Libraries 
● async 
● collection 
● html + js 
● io (server) 
● svg, web_gl, ... 
http://pub.dartlang.org 
● angular 
● googleapis 
● dquery (jQuery) 
● web_components 
polymer 
use js (libs) directly 
● intl well designed 
… but often not immutable
Web Components 
Polymer 
● Design your own 
HTML tags 
● Two-way binding 
Dart - DOM 
● Shadow DOM 
AngularDart 1.0new 
● Re-implementation 
⇒ AngularJs 2.0 
● MVC Framework 
o Controller - 
Directives - 
Components 
we don’t write HTML - we generate the DOM
Upgrades 
● Expect a new Version every 1-2 months 
o independent from library upgrade cycle 
o Started Dart 1.0 - Nov 2013 
 1.6.0 - Aug 2014 
 1.7 .. looming 
● Upgrade is quite painless 
o Also Library: pub upgrade
Dart Wishlist 
● CSS (Less/Saas) integration 
o Minify css names (like GWT) 
● Load Modules on demand 
o Split generated js (like GWT) 
● BigDecimal ⇉ Dec64 
● Ability to return tuples 
o … like Scala 
● Full Immutable library option
Dart Productivity: Good! 
● Easy to get going 
o Java ⇒ Functional 
● Good Tools 
o not on Java level 
● Rich Libraries 
● Performance 
o Benchmarks 
● Mostly Unsurprising 
semantics 
o No Strong Typing 
(like Scala) 
● Doc a bit light 
o helps if you know 
Javascript/HTML
Dart Performance (native, js, dart2js) 
https://www.dartlang.org/performance/
When “back” to Java Programming 
● where are named parameters? 
● why is async so hard? 
● very happy to get back to Dart: 
The better Javascript ! 
Douglas Crockford: 
Dart: too much baggage 
… waiting for the messiah
Questions ? 
Jorg Janke 
jorg@accorto.com 
Slides link:

Contenu connexe

Tendances

Dart programming tutorial
Dart programming tutorialDart programming tutorial
Dart programming tutorialHarikaReddy115
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersRutenis Turcinas
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)Ary Borenszweig
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type scriptDmitrii Stoian
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_scriptVijay Kalyan
 
Introduction to the Dart language
Introduction to the Dart languageIntroduction to the Dart language
Introduction to the Dart languageJana Moudrá
 
TypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript applicationTypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript applicationAndrea Paciolla
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideNascenia IT
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScriptGil Fink
 
Typescript: enjoying large scale browser development
Typescript: enjoying large scale browser developmentTypescript: enjoying large scale browser development
Typescript: enjoying large scale browser developmentJoost de Vries
 
Introduction about type script
Introduction about type scriptIntroduction about type script
Introduction about type scriptBinh Quan Duc
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painSander Mak (@Sander_Mak)
 
Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascriptAndrei Sebastian Cîmpean
 
introduction to javascript
introduction to javascriptintroduction to javascript
introduction to javascriptKumar
 

Tendances (20)

Dart Workshop
Dart WorkshopDart Workshop
Dart Workshop
 
Dart programming tutorial
Dart programming tutorialDart programming tutorial
Dart programming tutorial
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type script
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
 
Introduction to the Dart language
Introduction to the Dart languageIntroduction to the Dart language
Introduction to the Dart language
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
TypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript applicationTypeScript introduction to scalable javascript application
TypeScript introduction to scalable javascript application
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
 
Advanced PHP Simplified
Advanced PHP SimplifiedAdvanced PHP Simplified
Advanced PHP Simplified
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
 
Typescript: enjoying large scale browser development
Typescript: enjoying large scale browser developmentTypescript: enjoying large scale browser development
Typescript: enjoying large scale browser development
 
Introduction about type script
Introduction about type scriptIntroduction about type script
Introduction about type script
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
Code generating beans in Java
Code generating beans in JavaCode generating beans in Java
Code generating beans in Java
 
Java vs. C/C++
Java vs. C/C++Java vs. C/C++
Java vs. C/C++
 
Typescript for the programmers who like javascript
Typescript for the programmers who like javascriptTypescript for the programmers who like javascript
Typescript for the programmers who like javascript
 
introduction to javascript
introduction to javascriptintroduction to javascript
introduction to javascript
 
Java script
Java scriptJava script
Java script
 

Similaire à Dart the Better JavaScript

Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
Big data beyond the JVM - DDTX 2018
Big data beyond the JVM -  DDTX 2018Big data beyond the JVM -  DDTX 2018
Big data beyond the JVM - DDTX 2018Holden Karau
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)Crystal Language
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesEelco Visser
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsManuel Eusebio de Paz Carmona
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018Holden Karau
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausWomen in Technology Poland
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastHolden Karau
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsOWASP Kyiv
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Eugene Yokota
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleDmytro Semenov
 
Big Data Beyond the JVM - Strata San Jose 2018
Big Data Beyond the JVM - Strata San Jose 2018Big Data Beyond the JVM - Strata San Jose 2018
Big Data Beyond the JVM - Strata San Jose 2018Holden Karau
 
Lint, coverage, doc, autocompletion, transpilation, minification... powered b...
Lint, coverage, doc, autocompletion, transpilation, minification... powered b...Lint, coverage, doc, autocompletion, transpilation, minification... powered b...
Lint, coverage, doc, autocompletion, transpilation, minification... powered b...Alexandre Morgaut
 
Introduction to Spark ML Pipelines Workshop
Introduction to Spark ML Pipelines WorkshopIntroduction to Spark ML Pipelines Workshop
Introduction to Spark ML Pipelines WorkshopHolden Karau
 
A fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFsA fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFsHolden Karau
 

Similaire à Dart the Better JavaScript (20)

Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Big data beyond the JVM - DDTX 2018
Big data beyond the JVM -  DDTX 2018Big data beyond the JVM -  DDTX 2018
Big data beyond the JVM - DDTX 2018
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first steps
 
Evolution of Spark APIs
Evolution of Spark APIsEvolution of Spark APIs
Evolution of Spark APIs
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at last
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Big Data Beyond the JVM - Strata San Jose 2018
Big Data Beyond the JVM - Strata San Jose 2018Big Data Beyond the JVM - Strata San Jose 2018
Big Data Beyond the JVM - Strata San Jose 2018
 
Lint, coverage, doc, autocompletion, transpilation, minification... powered b...
Lint, coverage, doc, autocompletion, transpilation, minification... powered b...Lint, coverage, doc, autocompletion, transpilation, minification... powered b...
Lint, coverage, doc, autocompletion, transpilation, minification... powered b...
 
Introduction to Spark ML Pipelines Workshop
Introduction to Spark ML Pipelines WorkshopIntroduction to Spark ML Pipelines Workshop
Introduction to Spark ML Pipelines Workshop
 
Scala.js
Scala.js Scala.js
Scala.js
 
A fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFsA fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFs
 

Dernier

Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 

Dernier (20)

Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 

Dart the Better JavaScript

  • 1. Dart The better Javascript ? Jorg Janke jorg@accorto.com Slides link: http://bizfabrik.com October 2014
  • 2. Structure ● Why Dart? ● Example ● Dart Language ● Dart Tooling ● Questions The goal of Dart is "ultimately to replace JavaScript as the lingua franca of web development on the open web platform”
  • 3. Where are you coming from? ● Java o GWT o Servlet, JSP, JSF, .. ● .Net o Typescript ● PHP, Python, Ruby, … ● Mobile Native ● Javascript Front-end Technology
  • 4. Who is Jorg Janke? ● Education: MBA (Accounting), IT ● Jobs o ADV/Orga o Unisys - Prod.Mgr o Oracle - Dir Apps o Self employed since 1999 ● Experience o Mainframe, Unix, Linux o Algol, PL/I, SmallTalk o Oracle DBA o Java since 1.1 o Dart since 1.0 ● Founder: Compiere o Open Source ERP
  • 5. What is Dart ● OO/Functional Programming Language o Executed in Dartium (Chrome) o Generating Javascript Executable dart2js ● Created/Maintained by Google ● ECMA-408 Standard o http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf ● Targeting Client + Server
  • 6. Lot’s of good Dart Overviews Check ● https://www.dartlang.org/ ● Books ... ● http://video.coldfrontconf.com/ why-google-thinks-you-should-drop I concentrate here on Developer experience
  • 7. Dart - becoming popular ● TIOBE Index - October 2014 o #1: C 17% o #2: Java 14% o #3: Objective-C 10% - odd - a bit high o #4: C++ 4.8% o #10: JavaScript 1.7% - odd - a bit low o #17: Dart 1.1% o #25: ActionScript 0.6% o http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  • 8. Why we picked Dart … not stayed with GWT
  • 9. BizFabrik UI Requirements/Features ● Mobile First o disconnected ● 24/7 o active for days ● User o Expert/Guidance o Own Layout  switch o Analytics built in ● Admin o Add/Change Tables/ Fields/Processes/ Validations/... ● General o Dynamic Model Driven Architecture o Multi-Tenant/Locale o AWS/GAE/OnPremise
  • 10. What we wanted to avoid ● Multiple UIs - browser + naive(s) ● Hard to Develop o Good IDE - Step through Debugging ● Hard to Maintain (different code styles, …) .. in 5y o Developer Learning curve -- “Sonar” ● Hard to Understand o Partners/Customers to extend ● Fighting libraries - dependencies - conflicts
  • 11. Alternatives evaluated ● GWT (Used) o Easy Java Integration o Stable “mature” o Very good build process o A bit heavy o Lost in Translation (Java Structure <> JS features class <> prototypal) ● JSP/JSF/… o Connected only ● Coffeescript o Step in the right direction ● Typescript o commitment? ● Javascript “pure” o improved IDE support & tooling - JSLint o hard to build sizeable apps o too many different styles o no static analysis
  • 12. BizFabrik Architecture ● Java Backend o SOAP/REST ● Dart o (Bootstrap css) o Grid/Form/.. o Gantt Graph (svg) ● Communication o ? JSON (using Rest) ● Protocol Buffers o binary (smaller than JSON, especially data rows) o fast (~ same de/serializing speed) o Data Transfer Objects (get/set..) o for many languages
  • 13. Demo ~ 1,400 kb compressed js
  • 14. Grid Mode Built in Analytics/Data Visualization
  • 15. User defined - switchable Layout Form Guidance Mode
  • 16. Form Expert Mode Form|Grid Master/Detail/..
  • 17. All UIs dynamically generated Customizable + Dynamically Extendable (webhooks) Context dependent validation/visibility/layout (multiple levels) First dynamic MDA (Model Driven Architecture) Compiere ERP - 2000 Java Swing - 2007 GWT (1:1) Salesforce calls theirs MetaData Driven BizFabrik - redesigned from Scratch for Data Visualization of multiple DataSources - GWT 2012 redesigned from Scratch - Dart 2014 (3 months)
  • 18. Dart selection reasons ● Good DOM (Polyfill) API ● “Close to the metal” o eventually JS o Web Components, ... ● Streams, Futures ● Libraries ● Type support No worry about Javascript: The Bad Parts new - this - null - falsiness - for (in) - ... Douglas Crockford
  • 19. Static Typing increases Productivity ● Static typing and Documentation o Dynamic Languages require Context switches ● Source: Dr. A. Stefik, +An empirical study on the impact of static typing on software maintainabilityhttp://web.cs.unlv.edu/stefik a/Papers.php
  • 20. Dart Environment Dart Language core, collection, async, io, isolate, math, mirrors, typed_data DOM API html, svg, indexed_db, web_gl/audio/sql Pub Build / Libs / Packages Logging Intl Route Polymer Distribution Angular Dart Protocol Buff IDE: - Dart - IntelliJ Plugins: - Sublime etc Version Control + Dependencies Unittest
  • 21. Dart IDE options Dart IDE ● Scaled down old Eclipse version ● Usability ++ o Starts very fast o Getting started ● IDE Feature set -- o unstable with Dev Tools IntelliJ - Dart ● works with minor itches Full Eclipse ● not tried Chrome Dev Editor ● early days Debugging in Dartium
  • 22. Predefined Structure (Pub) ● bin ● doc ● example ● lib o lib.dart ● test ● tool ● web o project.dart o project.html ● pubspec.yaml ● packages o in main directory o links: sub directories  /web /tool /test /bin /example  (not /lib) o allows “package/..” references anywhere copied into packages
  • 23. Java Package => Libraries Java ● Directory = package ● File = class ● FileName = className Dart ● Directory, FileName does not matter... if you have good memory library libx; // part = code imports part “aa/bb/file.dart”; part of libx; class a{} class b{} aa/bb/file.dart
  • 24. Java Converts: You are ultimately writing Javascript !!! Javascript: The Good Parts
  • 25. Language Features ● Cannot cover all o for complete details see dartlang.org ● I like the most o single inheritance .. with mixins  intro to prototypal + functional programming ● with a safety net o named parameters
  • 26. Great! Optional / Named Parameters int f1 (int mandatory, {int optional: 2}) {..} use: f1(2); f1(2, optional: 3); int f2 (int mandatory, [int second = 2]) {..} use: f2(2); f2(1,2);
  • 27. Named Constructors ● MyClass(String this.p1, int this.i1) {} o saves the: this.p1 = p1; ● MyClass.fromXml(String xml) {..} o No overloading - better documentation o alternative  static MyClass parse(String xml) {..}
  • 28. Oohh well .. - no overloading workaround: String dump(dynamic param) { if (param is X1) return _dumpX1(param as X1); if (param is X2) return _dumpX2(param as X2); } String _dumpX1(X1 value) {..} String _dumpX2(X2 value) {..}
  • 29. Async done nicely + future one many sync T Iterable<T> (..) {..} (..) sync* {..} async Future<T> Stream<T> await (..) async {..} (..) async* {..} main() async { startAnalytics() async { // doesn’t block .. await .. await analytics.loadLib(); }
  • 30. Great! Function variables ● Example o static int parse(String s, { int onError(String s)}); ● Use o int xx=int.parse(“12”); o int xx=int.parse(“12”, onError: (String s) {return -1;}); o int xx=int.parse(“12”, onError: intErrorHandler); int intErrorHandler(String s) {return -1;} … if you are coming from Java7 … this and Streams eliminate “callback hell”
  • 31. Public - Internal - controlled class X { int public; int _internal; int get getter {..} void set setter (int value) {..} } Use: X xx = new X(); xx.public = 5; // r/w xx._internal = 5; // Library int z = xx.getter; xx.setter = 5; … a bit confusing at first when to use what: - function - isEmpty() - or attribute - isEmpty
  • 32. Better Strings String s = ’’’Multiple Line String’’’; s = “String” “ in” “ parts”; s = ‘This “works” too’; s = r’raw string n’; s = “String with ${param}”; if (s.isEmpty) {} if (s.isNotEmpty) {} trivial, but I like it Java char <> CodeUnit|CharCode
  • 33. Type Surprises (... coming from Java) bool initial = true; int active = 5; : int ms = initial ? 0 : 1000; if (active > 10) ms += (active/10) * 200; … compiles fine ms is an int - right?
  • 34. Type Surprises (... coming from Java) bool initial = true; int active = 5; : int ms = initial ? 0 : 1000; if (active > 10) ms += (active/10) * 200; … compiles fine ms is an int - right? Runtime: ● double Fix: ms += (active~/10) * 200; … compiler (analyzer) should catch that
  • 35. Type Surprises - Lists int add(List<int> ints) {..} int x = add([1,”a”, 3]); List<O1> o1List = …; List<O2> o2List = …; for (O1 in o2List) {..} … compiles fine Runtime Error … compiler (analyser) should catch that
  • 36. Libraries - Pub Core Libraries ● async ● collection ● html + js ● io (server) ● svg, web_gl, ... http://pub.dartlang.org ● angular ● googleapis ● dquery (jQuery) ● web_components polymer use js (libs) directly ● intl well designed … but often not immutable
  • 37. Web Components Polymer ● Design your own HTML tags ● Two-way binding Dart - DOM ● Shadow DOM AngularDart 1.0new ● Re-implementation ⇒ AngularJs 2.0 ● MVC Framework o Controller - Directives - Components we don’t write HTML - we generate the DOM
  • 38. Upgrades ● Expect a new Version every 1-2 months o independent from library upgrade cycle o Started Dart 1.0 - Nov 2013  1.6.0 - Aug 2014  1.7 .. looming ● Upgrade is quite painless o Also Library: pub upgrade
  • 39. Dart Wishlist ● CSS (Less/Saas) integration o Minify css names (like GWT) ● Load Modules on demand o Split generated js (like GWT) ● BigDecimal ⇉ Dec64 ● Ability to return tuples o … like Scala ● Full Immutable library option
  • 40. Dart Productivity: Good! ● Easy to get going o Java ⇒ Functional ● Good Tools o not on Java level ● Rich Libraries ● Performance o Benchmarks ● Mostly Unsurprising semantics o No Strong Typing (like Scala) ● Doc a bit light o helps if you know Javascript/HTML
  • 41. Dart Performance (native, js, dart2js) https://www.dartlang.org/performance/
  • 42. When “back” to Java Programming ● where are named parameters? ● why is async so hard? ● very happy to get back to Dart: The better Javascript ! Douglas Crockford: Dart: too much baggage … waiting for the messiah
  • 43. Questions ? Jorg Janke jorg@accorto.com Slides link: