Dart Flight School
Speaker Imam Raza
Licensed under http://creativecommons.org/licenses/by-nc/3.0/us/

#dartlang
Speaker.bio.toString()
●
●
●
●

12 years of professional experience.
Specialties include; Enterprise Software Architecture, Mobile devices
Architecture and software services including consulting, outsourcing and offshore
incubation.
Currently engaged with Folio3 as Senior Software Architect.
Motivation for today speech. Exploring latest technologies and creating awareness
about them is my hobby.

#dartlang
#dartlang
Why
?
✔ Improved productivity
✔ Increased performance

#dartlang
What is

✔ a new language(Javascript,JAVA/C# developer)
✔ Libraries
✔ Editor
✔ VM
✔ Browser that can run dart app natively
✔ Compiler to Javascript.

#dartlang
JavaScript Vs Dart(Language
Comparison)
✔ Classes: JS Prototyped based language and Not classbased language

✔ Static Typing: JS doesn’t support
✔ Language support for libraries:
#dartlang
Learn the language in under an hour

#dartlang
Use the tools you already know

#dartlang
Compile to JavaScript, runs across the modern web

#dartlang
Run Dart on the server with the Dart VM

#dartlang
Jasmine
Docs

PhantomJS
Docs

dest templates
Docs

moment.js
Docs

Modernizr
Docs

"Hi, Ijust wantbuild
"I want to to
writeweb app"
a web apps!"

jQuery
Docs

Backbone Marionette
Docs

Backbone

Docs

require.js
Docs

#dartlang
"Things are
consistent and
clear."

Pa
ck
ag
es

Intl
Polymer
Unit test

Dart SDK
#dartlang
Apps start small, but grow and scale
#dartlang
Simple syntax, ceremony free
class Hug {

Familiar

#dartlang
Simple syntax, ceremony free
class Hug {
num strength;
Hug(this.strength);

Terse

#dartlang
Simple syntax, ceremony free
class Hug {
num strength;
Hug(this.strength);
Hug operator +(Hug other) {
return new Hug(strength + other.strength);
}

Operator overriding

#dartlang
Simple syntax, ceremony free
class Hug {
num strength;
Hug(this.strength);
Hug operator +(Hug other) {
return new Hug(strength + other.strength);
}
void patBack({int hands: 1}) {
// ...
}

Named, optional params w/ default value

#dartlang
Simple syntax, ceremony free

// ...
Hug operator +(Hug other) {
return new Hug(strength + other.strength);
}
void patBack({int hands: 1}) {
// ...
}
One-line function
String toString() => "Embraceometer reads $strength";
}

#dartlang
Simple syntax, ceremony free

// ...
Hug operator +(Hug other) {
return new Hug(strength + other.strength);
}
void patBack({int hands: 1}) {
// ...
}
String toString() => "Embraceometer reads $strength";
}

String Interpolation

#dartlang
Clean semantics and behavior

#dartlang
Clean semantics and behavior

•
•
•

Examples:
Only true is truthy
There is no undefined, only null
No type coercion with ==, +
#dartlang
Missing getter?

"hello".missing // ??

Logical

Class 'String' has no instance getter 'missing'.
NoSuchMethodError : method not found: 'missing'
Receiver: "hello"
Arguments: []

#dartlang
String compared to number?

'hello' > 1 // ??

Logical

Class 'String' has no instance method '>'.

#dartlang
Variable scope?
No
hoisting
var foo = 'top-level';
main() {
if (true) { var foo = 'inside'; }
print(foo); // ?? What will this print?
}

Logical

top$level

#dartlang
Scope of this?

class AwesomeButton {
AwesomeButton(button) {
button.onClick.listen((Event e) => this.atomicDinosaurRock());
}
atomicDinosaurRock() {
/* ... */
}
}

Lexical
this

#dartlang
Scalable structure

Packages

library games;
import 'dart:math';
import 'players.dart';
class Darts {
// ...

Libraries

}
class Bowling {
// ...

Functions

Classes

}
Player findOpponent(int skillLevel) {
// ...

Mixins

Interfaces

}

#dartlang
Too many buttons
var$button$=$new$ButtonElement();
button.id$=$'fancy';
button.text$=$'Click$Point';
button.classes.add('important');
button.onClick.listen((e)$=>$addTopHat());
parentElement.children.add(button);
Yikes! Button is repeated 6 times!
#dartlang
Method cascades
var$button$=$new$ButtonElement()
$..id$=$'fancy'
$..text$=$'Click$Point'
$..classes.add('important')
$..onClick.listen((e)$=>$addTopHat());
parentElement.children.add(button);

#dartlang
Inline initialization

parentElement.children.add(
0new0ButtonElement()..text0=0'Click0Point');

#dartlang
One of these things is not like the other
Object
Persistable
Hug

Hug is not
is-a Persistable
Don't pollute
your inheritance
tree!
#dartlang
Don't inherit, mixin!
Object

Hug

Mixin

Persistable

#dartlang
Mixins
abstract'class'Persistable'{
'save()'{'...'}
'load()'{'...'}

Extend object & no
constructors? You
can be a mixin!

'toJson();
}
class'Hug'extends'Object'with'Persistable'{
'Map'toJson()'=>'{'strength':10};
}

Apply the mixin.

main()'{
'var'embrace'='new'Hug();
'embrace.save();
}''''''''

Use methods from
mixin.
#dartlang
Context switching considered harmful,
Iterate quickly

#dartlang
#dartlang
#dartlang
670+
packages
#dartlang
#dartlang
Compile Dart to JavaScript with dart2js

#dartlang
Tree shaking
imports

main
baz

Library

calls

foo

bar

boo

dart2js

main

foo

bar
#dartlang
Our challenge ...
clean semantics and unsurprising behavior
without
extra checks when compiled to JavaScript

#dartlang
DeltaBlue
addConstraintsConsumingTo(v, coll) {
var determining = v.determinedBy;
for (var i = 0; i < v.constraints.length; i++) {
var c = v.constraints[i];
if (c != determining && c.isSatisfied()) {
coll.add(c);
}
}
}

#dartlang
DeltaBlue: Unoptimized
addConstraintsConsumingTo$2: function(v, coll) {
var determining, t1, t2, t3, i, t4, c;
determining = v.get$determinedBy();
t1 = v.constraints;
t2 = getInterceptor$as(t1);
t3 = getInterceptor$a(coll);
i = 0;
while (true) {
t4 = t2.get$length(t1);

Simply not good
enough!

if (typeof t4 !== "number") throw new IllegalArgumentError(t4);
if (!(i < t4)) break;
c = t2.$index(t1, i);

if ((c == null ? determining != null : c !== determining) && c.isSatisfied$0() === true) {
t3.add$1(coll, c);
}
++i;
}
}

#dartlang
Global optimizations

•
•
o
o

Dart is structured and allows whole program analysis
Understanding your program’s structure enables:
Code navigation and great refactoring tools
Global compile-time optimizations

#dartlang
DeltaBlue: Fully optimized
addConstraintsConsumingTo$2: function(v, coll) {
var determining, t1, i, c;
determining = v.determinedBy;
for (t1 = v.constraints, i = 0; i < t1.length; ++i) {
c = t1[i];
if (c !== determining && c.isSatisfied$0()) {
coll.push(c);
}
}
}

262 characters, same
semantics

#dartlang
#dartlang
#dartlang
#dartlang
#dartlang
Old 'n busted

New hotness
<messages>
<message>
<subject>
Please fill out the TPS report
</subject>
<sent>2012-10-03</sent>
<summary>
I'm going to have to ask you to come in...
</summary>
</message>
<message>
<subject>
Reminder: fill out that TPS report!
</subject>
<sent>2012-10-04</sent>
<summary>
It's been 24 hours...
</summary>
</message>
...
</messages>
#dartlang
Encapsulated
<custom-element>
Structure
<div>
<input>
<p>
<span></span>
</p>
</div>

Behavior
tag.verifyAccount();

Styles
<style>
p { color: red; }
</style>
#dartlang
Reusable
Custom Element
import

HTML Page

import

HTML Page

import

HTML Page
#dartlang
Data binding
Data model

DOM Nodes

Data model

DOM Nodes
#dartlang
Future proof
ShadowDOM

HTML Imports

New web
specifications

<template>

Custom Elements

#dartlang
Using web components today

Polymer.dart
(today)

#dartlang
Custom elements everywhere!
<body>
<persistable-db dbname="game" storename="sologames"></persistable-db>
<game-assets></game-assets>
<game-app></game-app>
<google-signin clientId="250963735330.apps.googleusercontent.com"
signInMsg="Please sign in"></google-signin>

#dartlang
Angular is ported to Dart!

#dartlang
Angular and Polymer together
Angular controller

<div my-controller>
<div class="well">
<click-counter count="{{ctrl.count}}"></click-counter>
</div>
</div>

Polymer element

#dartlang
Dart in production
#dartlang
"Dart allows for quick prototyping as well as robust code
that is easy to refactor"
- Soundtrap

#dartlang
"Dart's familiar language, and cohesive set of libraries,
allowed the team to start building very quickly."
- Montage

#dartlang
"Dart offers a sane and consistent development experience for modern web applications."
- Blossom

#dartlang
"The source code for this game (Escape) is 20% smaller compared to the
ActionScript version (69.6 KB vs 86.5 KB). The port took only 6 hours."
-- Author of StageXL
#dartlang
Export Flash movies/games to
#dartlang
Dart from Flash Pro
#dartlang
"We rewrote Google's internal CRM app in 6 months, from
scratch, with Dart and Angular."
- Internal team at Google

#dartlang
TC52 to standardize Dart language

#dartlang
Ready to get started? Write a Dart app!

dartlang.org/codelabs/darrrt/
#dartlang
Dart - for the modern web

•
•
•

Platform you can use today
Easy to get started - dartlang.org
Compiles to JavaScript

#dartlang
Questions?

#dartlang

More Related Content

PDF
Start dart
PDF
Building DSLs On CLR and DLR (Microsoft.NET)
PDF
XKE - Programming Paradigms & Constructs
PPT
Debugging and Error handling
PPT
ImplementingChangeTrackingAndFlagging
PPT
Perl Tidy Perl Critic
PPT
Programming Paradigms
PDF
Save time by applying clean code principles
Start dart
Building DSLs On CLR and DLR (Microsoft.NET)
XKE - Programming Paradigms & Constructs
Debugging and Error handling
ImplementingChangeTrackingAndFlagging
Perl Tidy Perl Critic
Programming Paradigms
Save time by applying clean code principles

Viewers also liked (7)

PPTX
Google Developer Group(GDG) DevFest Event 2012 Android talk
PPTX
Apple WWDC 2014 highlights
PDF
Web Components and Modular CSS
PDF
Introduction to Web Components
PPTX
Web components
PPT
Reaching for the Future with Web Components and Polymer
PPTX
Web Components
Google Developer Group(GDG) DevFest Event 2012 Android talk
Apple WWDC 2014 highlights
Web Components and Modular CSS
Introduction to Web Components
Web components
Reaching for the Future with Web Components and Polymer
Web Components
Ad

Similar to GDG DART Event at Karachi (20)

PDF
Learn Dart And Angular, Get Your Web Development Wings With Kevin Moore
PDF
Dart, Darrt, Darrrt
PDF
What’s new in Google Dart - Seth Ladd
PDF
Structured web programming
PPTX
Dart : one language to rule them all - MixIT 2013
PDF
Dart - en ny platform til webudvikling af Rico Wind, Google
PPTX
Dart programming language
PPT
270_1_CIntro_Up_To_Functions.ppt 0478 computer
PPT
CIntro_Up_To_Functions.ppt;uoooooooooooooooooooo
PPTX
Rubyconf2016 - Solving communication problems in distributed teams with BDD
PDF
Introduction to Dart
PDF
Clean Code 2
PPT
270_1_CIntro_Up_To_Functions.ppt
PPT
Survey of programming language getting started in C
PPT
270_1_CIntro_Up_To_Functions.ppt
PPT
270 1 c_intro_up_to_functions
PPT
270_1_ChapterIntro_Up_To_Functions (1).ppt
PDF
the productive programer: mechanics
PPT
Oops lecture 1
Learn Dart And Angular, Get Your Web Development Wings With Kevin Moore
Dart, Darrt, Darrrt
What’s new in Google Dart - Seth Ladd
Structured web programming
Dart : one language to rule them all - MixIT 2013
Dart - en ny platform til webudvikling af Rico Wind, Google
Dart programming language
270_1_CIntro_Up_To_Functions.ppt 0478 computer
CIntro_Up_To_Functions.ppt;uoooooooooooooooooooo
Rubyconf2016 - Solving communication problems in distributed teams with BDD
Introduction to Dart
Clean Code 2
270_1_CIntro_Up_To_Functions.ppt
Survey of programming language getting started in C
270_1_CIntro_Up_To_Functions.ppt
270 1 c_intro_up_to_functions
270_1_ChapterIntro_Up_To_Functions (1).ppt
the productive programer: mechanics
Oops lecture 1
Ad

More from Imam Raza (7)

PPTX
Big Data with hadoop, Spark and BigQuery (Google cloud next Extended 2017 Kar...
PDF
Big Data University ML0101EN Certificate _ Big Data University
PPTX
GDG Devfest 2016 session on Android N
PPTX
Material design
PPTX
Polymer and web component
PPTX
MBaaS (Mobile Backend As a Service)
PPT
Android presentation
Big Data with hadoop, Spark and BigQuery (Google cloud next Extended 2017 Kar...
Big Data University ML0101EN Certificate _ Big Data University
GDG Devfest 2016 session on Android N
Material design
Polymer and web component
MBaaS (Mobile Backend As a Service)
Android presentation

Recently uploaded (20)

PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Five Habits of High-Impact Board Members
DOCX
search engine optimization ppt fir known well about this
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PPTX
Configure Apache Mutual Authentication
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PPT
Geologic Time for studying geology for geologist
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Architecture types and enterprise applications.pdf
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
Developing a website for English-speaking practice to English as a foreign la...
Five Habits of High-Impact Board Members
search engine optimization ppt fir known well about this
Enhancing plagiarism detection using data pre-processing and machine learning...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Configure Apache Mutual Authentication
Getting started with AI Agents and Multi-Agent Systems
A review of recent deep learning applications in wood surface defect identifi...
Improvisation in detection of pomegranate leaf disease using transfer learni...
Geologic Time for studying geology for geologist
Benefits of Physical activity for teenagers.pptx
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Architecture types and enterprise applications.pdf
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Build Your First AI Agent with UiPath.pptx
Comparative analysis of machine learning models for fake news detection in so...
1 - Historical Antecedents, Social Consideration.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
OpenACC and Open Hackathons Monthly Highlights July 2025

GDG DART Event at Karachi