SlideShare a Scribd company logo
Dart
The better Javascript
Jorg Janke
jorg@accorto.com
Slides link:
http://lightningdart.com
October 2015
Structure
● What & Why Dart?
● Dart Language & Tooling
● Questions
○ no need to wait until the end
Where are You coming from?
● Java
○ GWT
○ Servlet, JSP, JSF, ..
● .Net
● PHP, Python,
Ruby, …
● Mobile Native
Front-end
Technology
● Javascript
○ CoffeeScript
○ Typescript
○ Dart
✋
Who is Jorg Janke?
● Education: MBA
(Accounting), IT
● Jobs
○ ADV/Orga
○ Unisys - Prod.Mgr
○ Oracle - Dir Apps
○ Accorto since 1999
● Experience
○ Mainframe, Unix, Linux
○ Algol, PL/I, SmallTalk
○ Oracle DBA
○ Java since 1.1
○ Dart since 1.0
● Founder: Compiere
○ Open Source ERP
What does Accorto do?
● Professional Services Automation (PSA)
on Salesforce https://www.accorto.com
○ Projects
■ Gantt
■ Resource Planning
○ Capturing Time & Expense
○ Billing
Dart Overview
ECMA-408
What is Dart?
● OO & Functional Programming Language
○ Debugged in Dartium (Chrome)
○ Generating Javascript Executable dart2js
● Created/Maintained by Google
● ECMA-408 Standard
○ http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf
● Targeting Client + Server
Dart Motivation
● Fast development cycles
● Fast & predictable performance
● Clear language semantics
● String types for great tool support
Change: from Dartium (own runtime engine)
➤ Javascript only
Lot’s of good Dart Overviews
Check
● https://www.dartlang.org
● Books ...
● https://www.dartlang.org/slides
I concentrate here on Developer experience
UI Options
Angular 2.0 - Now
https://github.com/ng2-dart-samples
● smaller gen JS
● 3x faster than 1.0
Dart Polymer
● Web Components
Bring Your Own
JS Framework
● JS Interop
Lightning Dart
● Lightning Experience UX
Dart Mobile - also native
● Share code
○ IOS
○ Android
○ Web
● Fletch (Runtime)
○ adds ~220k native App
○ on-the-fly code changes - also on iOS
UI for iOS
(Objective-C)
UI for Android
(Java)
Application Model
(Dart)
Runtime (Fletch)
Early Days!
Dart - Google Trends
Why pick Dart?
Accorto UI Requirements/Features
● Mobile First
○ disconnected
● 24/7
○ active for days
● User
○ Expert/Guidance
○ Own Layout
■ switch
○ Analytics built in
● Admin
○ Add/Change Tables/
Fields/Processes/
Validations/...
● General
○ Dynamic Model Driven
Architecture
○ Multi-Tenant/Locale
○ AWS/GAE/OnPremise
What we wanted to avoid
● Multiple UIs - browser + naive(s)
● Hard to Develop
○ Good IDE - Step through Debugging
● Hard to Maintain (different code styles, …) .. in 5y
○ Developer Learning curve -- “Sonar”
● Hard to Understand
○ Partners/Customers to extend
● Fighting libraries - dependencies - conflicts
Alternatives evaluated
● GWT (Used)
○ Easy Java Integration
○ Stable “mature”
○ Very good build process
○ A bit heavy
○ Lost in Translation (Java
Structure <> JS features
class <> prototypal)
● JSP/JSF/…
○ Connected only
● Coffeescript
○ Step in the right direction
● Typescript
○ step in the right direction
● Javascript “pure”
○ improved IDE support &
tooling - JSLint
○ hard to build sizeable apps
○ too many different styles
○ no static analysis
Dart selection reasons
● Good DOM (Polyfill)
API
● “Close to the metal”
○ eventually JS
○ Web Components, ...
● Streams, Futures
● Libraries
● Static Type support
No worry about
Javascript:
The Bad Parts
new - this - null - falsiness -
for (in) - class ...
Douglas Crockford
prototypal vs class
Static Typing increases Productivity
● Static typing and
Documentation
○ Dynamic Languages
require Context
switches
● Source: Dr. A. Stefik, +
An empirical study on the impact of static
typing on software maintainability
http://web.cs.unlv.edu/stefika/Papers.php
Accorto Architecture now
● Java Backend
○ SOAP/REST
■ Salesforce
● Lightning Design
○ scss
● Dart
○ Grid/Form/..
○ Gantt Graph (svg)
● Protocol Buffers
○ binary (smaller than
JSON, especially
data rows)
○ fast (~ same
de/serializing speed)
○ Data Transfer
Objects (get/set..)
○ for many languages
Lightning Design System
● Salesforce UX
https://www.lightningdesignsystem.com
○ SCSS - Font - Icons
○ General Purpose
■ Not restricted to
salesforce.com
● Lightning Dart
○ Functionality
● Components
○ Button … Picklist
● Controller
○ Form, Object
➤ Optimized Javascript
○ optimal low-level
language features
○ speed
➤ Typed code
● Maintainability
○ Well structured code
○ Not Optimization
● Productivity
○ Easy Debugging
Dart ⟹ Productivity & Efficiency
Dart Source dart2js js
Analyzer
Observatory
(profiler)
fmt, doc
Dart Environment
Dart Language
core, collection,
async, io, isolate, math,
mirrors, typed_data
DOM API
html, svg, indexed_db,
web_gl/audio/sql
Polymer
Angular Dart
Logging
Intl
Route
Packages
Protocol Buff
IDE:
- IntelliJ
DartPad
Plugins:
- Sublime
- Eclipse
- ...
Version Control
+ Dependencies
Test
Pub
Build / Libs / Distribution
...
Dart IDE options
WebStorm IDE
● Plugin
Other Editors
● Sublime, Eclipse,
Atom, Emacs, Vim
DartPad
https://dartpad.dartlang.org
● Interactive Editor
& Playground
Predefined Structure (Pub)
● bin
● doc
● example
● lib
○ lib.dart
● test
● tool
● web
○ project.dart
○ project.html
● pubspec.yaml
● packages
○ in main directory
○ links: sub directories
■ /web /tool /test
/bin /example
■ (not /lib)
○ allows “package/..”
references anywhere
copied into
packages
Testing made easy
@TestOn(“browser && !chrome”)
group(“my group”, () {
test(“my test”, () {
expect(11.remainder(3), equals(2));
});
test(“my async”, () async {
var value = await new Future.value(10);
expect(value, allOf([ ..matcher.. ])));
});
});
● pub run test
○ chrome, safari, ie, ff
○ content-shell (headless)
○ android,
○ mac-os, windows, ..
○ phantomjs
● pub global activate test_runner
○ run_tests
● dart webdriver
Java Converts:
You are ultimately writing Javascript !!!
Language Features
● Cannot cover all
○ for complete details see dartlang.org
● I like the most
○ single inheritance .. with mixins
■ intro to prototypal + functional programming
● with a safety net
○ named parameters
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
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) {}
○ saves the: this.p1 = p1;
● MyClass.fromXml(String xml) {..}
○ No overloading - better documentation
○ alternative
■ static MyClass parse(String xml) {..}
No overloading - but not missing it!
workaround if you want to:
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();
} enableControls(); }
Great! Function variables
● Example
○ static int parse(String s, { int onError(String s)});
● Use
○ int xx=int.parse(“12”);
○ int xx=int.parse(“12”, onError: (String s) {return -1;});
○ 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)
int active = 5;
:
int ms = initial;
if (active > 10)
ms += (active/10) * 200;
… compiles fine
ms is an int - right?
Runtime:
● double
Fix:
ms += (active~/10) * 200;
… Analyzer catches direct
assignments but not +=
Type Surprises - Lists
void add(List<int> ints) {..}
add([1,”a”, 3]);
List<O1> o1List = …;
List<O2> o2List = …;
for (O1 in o2List) {..}
… compiles fine
Runtime Error
… compiler (analyser)
should catch that
… certainly better than
plain Javascript
Libraries - Pub
Core Libraries
● async
● collection
● html + js
● io (server)
● svg, web_gl, ...
http://pub.dartlang.org
● angular
● googleapis
● dquery (jQuery)
● web_components
polymer
● intlwell designed
… but often not immutable
use js (libs) directly
Upgrades
● Expect a new Version every 1-2 months
○ independent from library upgrade cycle
○ Started Dart 1.0 - Nov 2013
■ 1.12.0 - Aug 2015
■ 1.13 .. looming
● Upgrade is quite painless
○ Also Library: pub upgrade
Dart Wishlist
● BigDecimal ⇉ Dec64 (vs double)
● Ability to return tuples
○ … like Scala
● Full Immutable library option
● CSS (Less/Saas) integration
○ Package + Minify css (like GWT)
Concentrate on Client!
Dart Productivity: Good!
● Easy to get going
○ Java ⇒ Functional
● Good Tools
○ not on Java level
● Rich Libraries
● Profiling
○ Observatory
● Mostly Unsurprising
semantics
○ No Strong Typing
(like Scala)
● Doc a bit light
○ helps if you know
Javascript/HTML
Summary (why not Javascript directly)
● Productivity
○ typed language
○ concise
■ especially async
○ tooling
○ libraries
○ debug & test
● Maintainability
○ dart2js optimizes
● Dev Compiler
○ create JS libraries
(alpha)
● Maintainable and
efficient Javascript
○ Very hard to manually
do - collaboratively
■ JS the good parts
When “back” to Java Programming
● where are named parameters?
● why is async so hard?
● very happy to get back to
● Dart:
The better Javascript !
Questions ?
Jorg Janke jorg@accorto.com
Slides link: http://lightningdart.com

More Related Content

What's hot

Dart presentation
Dart presentationDart presentation
Dart presentation
Lucas Leal
 
Dart programming tutorial
Dart programming tutorialDart programming tutorial
Dart programming tutorial
HarikaReddy115
 
Dart
DartDart
XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & Constructs
Nicolas Demengel
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
Martin Odersky
 
From DOT to Dotty
From DOT to DottyFrom DOT to Dotty
From DOT to Dotty
Martin Odersky
 
F# Type Provider for R Statistical Platform
F# Type Provider for R Statistical PlatformF# Type Provider for R Statistical Platform
F# Type Provider for R Statistical PlatformHoward Mansell
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Rahul Jain
 
Python for katana
Python for katanaPython for katana
Python for katana
kedar nath
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Chicago Hadoop Users Group
 
Maths&programming forartists wip
Maths&programming forartists wipMaths&programming forartists wip
Maths&programming forartists wip
kedar nath
 
introduction to javascript
introduction to javascriptintroduction to javascript
introduction to javascriptKumar
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
Vijay Kalyan
 
Mel for beginners
Mel for beginnersMel for beginners
Mel for beginners
kedar nath
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
Common Programming Paradigms
Common Programming ParadigmsCommon Programming Paradigms
Common Programming Paradigms
Suheyl Zafar
 
C# in depth
C# in depthC# in depth
C# in depth
Arnon Axelrod
 
C++ programming
C++ programmingC++ programming

What's hot (20)

Dart presentation
Dart presentationDart presentation
Dart presentation
 
Dart programming tutorial
Dart programming tutorialDart programming tutorial
Dart programming tutorial
 
Dart
DartDart
Dart
 
XKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & ConstructsXKE - Programming Paradigms & Constructs
XKE - Programming Paradigms & Constructs
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
 
From DOT to Dotty
From DOT to DottyFrom DOT to Dotty
From DOT to Dotty
 
F# Type Provider for R Statistical Platform
F# Type Provider for R Statistical PlatformF# Type Provider for R Statistical Platform
F# Type Provider for R Statistical Platform
 
C sharp
C sharpC sharp
C sharp
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Python for katana
Python for katanaPython for katana
Python for katana
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
 
Maths&programming forartists wip
Maths&programming forartists wipMaths&programming forartists wip
Maths&programming forartists wip
 
introduction to javascript
introduction to javascriptintroduction to javascript
introduction to javascript
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
 
Mel for beginners
Mel for beginnersMel for beginners
Mel for beginners
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Common Programming Paradigms
Common Programming ParadigmsCommon Programming Paradigms
Common Programming Paradigms
 
C# in depth
C# in depthC# in depth
C# in depth
 
C++ programming
C++ programmingC++ programming
C++ programming
 

Viewers also liked

Semantic web
Semantic webSemantic web
Understanding RDF: the Resource Description Framework in Context (1999)
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)
Dan Brickley
 
Resource description framework
Resource description frameworkResource description framework
Resource description framework
hozifa1010
 
A First Course in RDF and RDFS (Resource Description Framework and Resource D...
A First Course in RDF and RDFS (Resource Description Framework and Resource D...A First Course in RDF and RDFS (Resource Description Framework and Resource D...
A First Course in RDF and RDFS (Resource Description Framework and Resource D...
Mark Birbeck
 
Artificial Intelligence and Expert Systems
Artificial Intelligence and Expert SystemsArtificial Intelligence and Expert Systems
Artificial Intelligence and Expert SystemsSiddhant Agarwal
 
NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...
NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...
NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...
NexJ Systems Inc.
 
Play Framework (anatomy of a play application) @ Codacy
Play Framework (anatomy of a play application) @ CodacyPlay Framework (anatomy of a play application) @ Codacy
Play Framework (anatomy of a play application) @ Codacy
Rodrigo Fernandes
 
How to Hire a PR Firm
How to Hire a PR FirmHow to Hire a PR Firm
How to Hire a PR Firm
PMG Public Relations
 
Introducing ProspectStream
Introducing ProspectStreamIntroducing ProspectStream
Introducing ProspectStream
ProspectStream
 
Infocom webinar race car metaphore
Infocom webinar   race car metaphoreInfocom webinar   race car metaphore
Infocom webinar race car metaphore
Corelytics by CoreConnex, Inc.
 
How to Call A from B in Ember
How to Call A from B in EmberHow to Call A from B in Ember
How to Call A from B in Ember
Ben Donaldson
 
Web 2.0 and the world of global collaboration v2010
Web 2.0 and the world of global collaboration v2010Web 2.0 and the world of global collaboration v2010
Web 2.0 and the world of global collaboration v2010
GroveSite
 
8 Reason You Need Mobile CRM
8 Reason You Need Mobile CRM8 Reason You Need Mobile CRM
8 Reason You Need Mobile CRM
Enbu Consulting
 
Stop Branding Pollution: Managing brand complexity & ensuring consistency
Stop Branding Pollution: Managing brand complexity & ensuring consistencyStop Branding Pollution: Managing brand complexity & ensuring consistency
Stop Branding Pollution: Managing brand complexity & ensuring consistency
ConceptShare
 
知识到底是什麽?
知识到底是什麽? 知识到底是什麽?
知识到底是什麽?
BroadVision
 
Step Up Business Intelligence
Step Up Business Intelligence Step Up Business Intelligence
Step Up Business Intelligence
Angoss Software Corporation
 
What Lies Ahead
What Lies AheadWhat Lies Ahead
What Lies Ahead
Moboom
 
Alacra On Demand
Alacra On DemandAlacra On Demand
Alacra On Demand
Alacra, Inc
 
Real Estate Investment Guide - Waveland, Mississippi
Real Estate Investment Guide - Waveland, MississippiReal Estate Investment Guide - Waveland, Mississippi
Real Estate Investment Guide - Waveland, MississippiMarco Santarelli
 

Viewers also liked (20)

Semantic web
Semantic webSemantic web
Semantic web
 
Understanding RDF: the Resource Description Framework in Context (1999)
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)
 
Resource description framework
Resource description frameworkResource description framework
Resource description framework
 
A First Course in RDF and RDFS (Resource Description Framework and Resource D...
A First Course in RDF and RDFS (Resource Description Framework and Resource D...A First Course in RDF and RDFS (Resource Description Framework and Resource D...
A First Course in RDF and RDFS (Resource Description Framework and Resource D...
 
Artificial Intelligence and Expert Systems
Artificial Intelligence and Expert SystemsArtificial Intelligence and Expert Systems
Artificial Intelligence and Expert Systems
 
NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...
NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...
NexJ CDM Overview: Better Understand Customers with NexJ Customer Data Manage...
 
Play Framework (anatomy of a play application) @ Codacy
Play Framework (anatomy of a play application) @ CodacyPlay Framework (anatomy of a play application) @ Codacy
Play Framework (anatomy of a play application) @ Codacy
 
How to Hire a PR Firm
How to Hire a PR FirmHow to Hire a PR Firm
How to Hire a PR Firm
 
Introducing ProspectStream
Introducing ProspectStreamIntroducing ProspectStream
Introducing ProspectStream
 
Infocom webinar race car metaphore
Infocom webinar   race car metaphoreInfocom webinar   race car metaphore
Infocom webinar race car metaphore
 
How to Call A from B in Ember
How to Call A from B in EmberHow to Call A from B in Ember
How to Call A from B in Ember
 
Impel elemech-company
Impel elemech-companyImpel elemech-company
Impel elemech-company
 
Web 2.0 and the world of global collaboration v2010
Web 2.0 and the world of global collaboration v2010Web 2.0 and the world of global collaboration v2010
Web 2.0 and the world of global collaboration v2010
 
8 Reason You Need Mobile CRM
8 Reason You Need Mobile CRM8 Reason You Need Mobile CRM
8 Reason You Need Mobile CRM
 
Stop Branding Pollution: Managing brand complexity & ensuring consistency
Stop Branding Pollution: Managing brand complexity & ensuring consistencyStop Branding Pollution: Managing brand complexity & ensuring consistency
Stop Branding Pollution: Managing brand complexity & ensuring consistency
 
知识到底是什麽?
知识到底是什麽? 知识到底是什麽?
知识到底是什麽?
 
Step Up Business Intelligence
Step Up Business Intelligence Step Up Business Intelligence
Step Up Business Intelligence
 
What Lies Ahead
What Lies AheadWhat Lies Ahead
What Lies Ahead
 
Alacra On Demand
Alacra On DemandAlacra On Demand
Alacra On Demand
 
Real Estate Investment Guide - Waveland, Mississippi
Real Estate Investment Guide - Waveland, MississippiReal Estate Investment Guide - Waveland, Mississippi
Real Estate Investment Guide - Waveland, Mississippi
 

Similar to Dart the better Javascript 2015

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
Jorg Janke
 
Scaling xtext
Scaling xtextScaling xtext
Scaling xtext
Lieven Lemiengre
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career Roadmap
WebStackAcademy
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
Dmytro Semenov
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developers
bennuttall
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
Linaro
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
Mukesh Singh
 
Quality Assurance in PostgreSQL
Quality Assurance in PostgreSQLQuality Assurance in PostgreSQL
Quality Assurance in PostgreSQL
Aleksander Alekseev
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaBuilding a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Mushfekur Rahman
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
Juho Teperi
 
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Hakka Labs
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
Phil Eaton
 
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
Women in Technology Poland
 
[scala.by] Launching new application fast
[scala.by] Launching new application fast[scala.by] Launching new application fast
[scala.by] Launching new application fast
Denis Karpenko
 
Robust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time ChecksRobust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time Checks
Stoyan Nikolov
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
ArangoDB Database
 
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
OWASP Kyiv
 
2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million
Омские ИТ-субботники
 

Similar to Dart the better Javascript 2015 (20)

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Scaling xtext
Scaling xtextScaling xtext
Scaling xtext
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career Roadmap
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developers
 
Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
Quality Assurance in PostgreSQL
Quality Assurance in PostgreSQLQuality Assurance in PostgreSQL
Quality Assurance in PostgreSQL
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaBuilding a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
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
 
[scala.by] Launching new application fast
[scala.by] Launching new application fast[scala.by] Launching new application fast
[scala.by] Launching new application fast
 
Robust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time ChecksRobust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time Checks
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
 
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million
 

Recently uploaded

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 

Recently uploaded (20)

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 

Dart the better Javascript 2015

  • 1. Dart The better Javascript Jorg Janke jorg@accorto.com Slides link: http://lightningdart.com October 2015
  • 2. Structure ● What & Why Dart? ● Dart Language & Tooling ● Questions ○ no need to wait until the end
  • 3. Where are You coming from? ● Java ○ GWT ○ Servlet, JSP, JSF, .. ● .Net ● PHP, Python, Ruby, … ● Mobile Native Front-end Technology ● Javascript ○ CoffeeScript ○ Typescript ○ Dart ✋
  • 4. Who is Jorg Janke? ● Education: MBA (Accounting), IT ● Jobs ○ ADV/Orga ○ Unisys - Prod.Mgr ○ Oracle - Dir Apps ○ Accorto since 1999 ● Experience ○ Mainframe, Unix, Linux ○ Algol, PL/I, SmallTalk ○ Oracle DBA ○ Java since 1.1 ○ Dart since 1.0 ● Founder: Compiere ○ Open Source ERP
  • 5. What does Accorto do? ● Professional Services Automation (PSA) on Salesforce https://www.accorto.com ○ Projects ■ Gantt ■ Resource Planning ○ Capturing Time & Expense ○ Billing
  • 7. What is Dart? ● OO & Functional Programming Language ○ Debugged in Dartium (Chrome) ○ Generating Javascript Executable dart2js ● Created/Maintained by Google ● ECMA-408 Standard ○ http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf ● Targeting Client + Server
  • 8. Dart Motivation ● Fast development cycles ● Fast & predictable performance ● Clear language semantics ● String types for great tool support Change: from Dartium (own runtime engine) ➤ Javascript only
  • 9. Lot’s of good Dart Overviews Check ● https://www.dartlang.org ● Books ... ● https://www.dartlang.org/slides I concentrate here on Developer experience
  • 10. UI Options Angular 2.0 - Now https://github.com/ng2-dart-samples ● smaller gen JS ● 3x faster than 1.0 Dart Polymer ● Web Components Bring Your Own JS Framework ● JS Interop Lightning Dart ● Lightning Experience UX
  • 11. Dart Mobile - also native ● Share code ○ IOS ○ Android ○ Web ● Fletch (Runtime) ○ adds ~220k native App ○ on-the-fly code changes - also on iOS UI for iOS (Objective-C) UI for Android (Java) Application Model (Dart) Runtime (Fletch) Early Days!
  • 12. Dart - Google Trends
  • 14. Accorto UI Requirements/Features ● Mobile First ○ disconnected ● 24/7 ○ active for days ● User ○ Expert/Guidance ○ Own Layout ■ switch ○ Analytics built in ● Admin ○ Add/Change Tables/ Fields/Processes/ Validations/... ● General ○ Dynamic Model Driven Architecture ○ Multi-Tenant/Locale ○ AWS/GAE/OnPremise
  • 15. What we wanted to avoid ● Multiple UIs - browser + naive(s) ● Hard to Develop ○ Good IDE - Step through Debugging ● Hard to Maintain (different code styles, …) .. in 5y ○ Developer Learning curve -- “Sonar” ● Hard to Understand ○ Partners/Customers to extend ● Fighting libraries - dependencies - conflicts
  • 16. Alternatives evaluated ● GWT (Used) ○ Easy Java Integration ○ Stable “mature” ○ Very good build process ○ A bit heavy ○ Lost in Translation (Java Structure <> JS features class <> prototypal) ● JSP/JSF/… ○ Connected only ● Coffeescript ○ Step in the right direction ● Typescript ○ step in the right direction ● Javascript “pure” ○ improved IDE support & tooling - JSLint ○ hard to build sizeable apps ○ too many different styles ○ no static analysis
  • 17. Dart selection reasons ● Good DOM (Polyfill) API ● “Close to the metal” ○ eventually JS ○ Web Components, ... ● Streams, Futures ● Libraries ● Static Type support No worry about Javascript: The Bad Parts new - this - null - falsiness - for (in) - class ... Douglas Crockford prototypal vs class
  • 18. Static Typing increases Productivity ● Static typing and Documentation ○ Dynamic Languages require Context switches ● Source: Dr. A. Stefik, + An empirical study on the impact of static typing on software maintainability http://web.cs.unlv.edu/stefika/Papers.php
  • 19. Accorto Architecture now ● Java Backend ○ SOAP/REST ■ Salesforce ● Lightning Design ○ scss ● Dart ○ Grid/Form/.. ○ Gantt Graph (svg) ● Protocol Buffers ○ binary (smaller than JSON, especially data rows) ○ fast (~ same de/serializing speed) ○ Data Transfer Objects (get/set..) ○ for many languages
  • 20. Lightning Design System ● Salesforce UX https://www.lightningdesignsystem.com ○ SCSS - Font - Icons ○ General Purpose ■ Not restricted to salesforce.com ● Lightning Dart ○ Functionality ● Components ○ Button … Picklist ● Controller ○ Form, Object
  • 21. ➤ Optimized Javascript ○ optimal low-level language features ○ speed ➤ Typed code ● Maintainability ○ Well structured code ○ Not Optimization ● Productivity ○ Easy Debugging Dart ⟹ Productivity & Efficiency Dart Source dart2js js Analyzer Observatory (profiler) fmt, doc
  • 22. Dart Environment Dart Language core, collection, async, io, isolate, math, mirrors, typed_data DOM API html, svg, indexed_db, web_gl/audio/sql Polymer Angular Dart Logging Intl Route Packages Protocol Buff IDE: - IntelliJ DartPad Plugins: - Sublime - Eclipse - ... Version Control + Dependencies Test Pub Build / Libs / Distribution ...
  • 23. Dart IDE options WebStorm IDE ● Plugin Other Editors ● Sublime, Eclipse, Atom, Emacs, Vim DartPad https://dartpad.dartlang.org ● Interactive Editor & Playground
  • 24. Predefined Structure (Pub) ● bin ● doc ● example ● lib ○ lib.dart ● test ● tool ● web ○ project.dart ○ project.html ● pubspec.yaml ● packages ○ in main directory ○ links: sub directories ■ /web /tool /test /bin /example ■ (not /lib) ○ allows “package/..” references anywhere copied into packages
  • 25. Testing made easy @TestOn(“browser && !chrome”) group(“my group”, () { test(“my test”, () { expect(11.remainder(3), equals(2)); }); test(“my async”, () async { var value = await new Future.value(10); expect(value, allOf([ ..matcher.. ]))); }); }); ● pub run test ○ chrome, safari, ie, ff ○ content-shell (headless) ○ android, ○ mac-os, windows, .. ○ phantomjs ● pub global activate test_runner ○ run_tests ● dart webdriver
  • 26. Java Converts: You are ultimately writing Javascript !!!
  • 27. Language Features ● Cannot cover all ○ for complete details see dartlang.org ● I like the most ○ single inheritance .. with mixins ■ intro to prototypal + functional programming ● with a safety net ○ named parameters
  • 28. 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
  • 29. 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);
  • 30. Named Constructors ● MyClass(String this.p1, int this.i1) {} ○ saves the: this.p1 = p1; ● MyClass.fromXml(String xml) {..} ○ No overloading - better documentation ○ alternative ■ static MyClass parse(String xml) {..}
  • 31. No overloading - but not missing it! workaround if you want to: 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) {..}
  • 32. 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(); } enableControls(); }
  • 33. Great! Function variables ● Example ○ static int parse(String s, { int onError(String s)}); ● Use ○ int xx=int.parse(“12”); ○ int xx=int.parse(“12”, onError: (String s) {return -1;}); ○ 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”
  • 34. 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
  • 35. 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
  • 36. Type Surprises (... coming from Java) int active = 5; : int ms = initial; if (active > 10) ms += (active/10) * 200; … compiles fine ms is an int - right? Runtime: ● double Fix: ms += (active~/10) * 200; … Analyzer catches direct assignments but not +=
  • 37. Type Surprises - Lists void add(List<int> ints) {..} add([1,”a”, 3]); List<O1> o1List = …; List<O2> o2List = …; for (O1 in o2List) {..} … compiles fine Runtime Error … compiler (analyser) should catch that … certainly better than plain Javascript
  • 38. Libraries - Pub Core Libraries ● async ● collection ● html + js ● io (server) ● svg, web_gl, ... http://pub.dartlang.org ● angular ● googleapis ● dquery (jQuery) ● web_components polymer ● intlwell designed … but often not immutable use js (libs) directly
  • 39. Upgrades ● Expect a new Version every 1-2 months ○ independent from library upgrade cycle ○ Started Dart 1.0 - Nov 2013 ■ 1.12.0 - Aug 2015 ■ 1.13 .. looming ● Upgrade is quite painless ○ Also Library: pub upgrade
  • 40. Dart Wishlist ● BigDecimal ⇉ Dec64 (vs double) ● Ability to return tuples ○ … like Scala ● Full Immutable library option ● CSS (Less/Saas) integration ○ Package + Minify css (like GWT) Concentrate on Client!
  • 41. Dart Productivity: Good! ● Easy to get going ○ Java ⇒ Functional ● Good Tools ○ not on Java level ● Rich Libraries ● Profiling ○ Observatory ● Mostly Unsurprising semantics ○ No Strong Typing (like Scala) ● Doc a bit light ○ helps if you know Javascript/HTML
  • 42. Summary (why not Javascript directly) ● Productivity ○ typed language ○ concise ■ especially async ○ tooling ○ libraries ○ debug & test ● Maintainability ○ dart2js optimizes ● Dev Compiler ○ create JS libraries (alpha) ● Maintainable and efficient Javascript ○ Very hard to manually do - collaboratively ■ JS the good parts
  • 43. When “back” to Java Programming ● where are named parameters? ● why is async so hard? ● very happy to get back to ● Dart: The better Javascript !
  • 44. Questions ? Jorg Janke jorg@accorto.com Slides link: http://lightningdart.com