Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ZHGDG[7.27]GDL.3~10 Reasons You_ll Love Dart
Search
Zoom.Quiet
July 29, 2013
Technology
0
92
ZHGDG[7.27]GDL.3~10 Reasons You_ll Love Dart
ZHGDG[7.27]GDL.3
10 Reasons You_ll Love Dart Presentation
Zoom.Quiet
July 29, 2013
Tweet
Share
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
150
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
120
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
99
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
88
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
87
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
100
PyCon2014China-Zhuhai-jeff
zoomquiet
0
78
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
110
DevFest2014-Zhuhai-Polymer
zoomquiet
0
400
Other Decks in Technology
See All in Technology
Prox Industries株式会社 会社紹介資料
proxindustries
0
210
米国国防総省のDevSecOpsライフサイクルをAWSのセキュリティサービスとOSSで実現
syoshie
2
810
ユーザーのプロフィールデータを活用した推薦精度向上の取り組み
yudai00
0
490
標準技術と独自システムで作る「つらくない」SaaS アカウント管理 / Effortless SaaS Account Management with Standard Technologies & Custom Systems
yuyatakeyama
2
1k
ローカルLLMでファインチューニング
knishioka
0
130
Windows 11 で AWS Documentation MCP Server 接続実践/practical-aws-documentation-mcp-server-connection-on-windows-11
emiki
0
710
CSS、JSをHTMLテンプレートにまとめるフロントエンド戦略
d120145
0
220
Amplifyとゼロからはじめた AIコーディング 成果と展望
mkdev10
1
360
20250625 Snowflake Summit 2025活用事例 レポート / Nowcast Snowflake Summit 2025 Case Study Report
kkuv
1
210
Observability infrastructure behind the trillion-messages scale Kafka platform
lycorptech_jp
PRO
0
130
ObsidianをMCP連携させてみる
ttnyt8701
2
140
2025/6/21 日本学術会議公開シンポジウム発表資料
keisuke198619
2
480
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
41
7.3k
Practical Orchestrator
shlominoach
188
11k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
VelocityConf: Rendering Performance Case Studies
addyosmani
330
24k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Thoughts on Productivity
jonyablonski
69
4.7k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Automating Front-end Workflow
addyosmani
1370
200k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Transcript
10 Reasons You're Going to Love Dart Chris Strom @eee_c
• Browser Language (primarily) • Familiar • Incorporates Lessons Learned
JavaScript • Browser Language (primarily) • Familiar • Incorporates Lessons
Learned
10+
-Alan Perlis A language that doesn't affect the way you
think about programming, is not worth knowing.
Ew... Static Typing
hostile to the open-web non-standard language
Nobody is using it…
Quick Dart Primer: Functions say_hi(name) { return "Hi, ${name}"; }
say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions say_hi(name) { return "Hi, ${name}"; }
say_hi("Bob"); // "Hi, Bob"
say_hi(name) { return "Hi, ${name}"; } say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions
Quick Dart Primer: Functions say_hi(name) { return "Hi, ${name}"; }
say_hi("Bob"); // "Hi, Bob"
say_hi(name) { return "Hi, ${name}"; } say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions
say_hi(name) { return "Hi, ${name}"; } say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions
say_hi(name) { return "Hi, ${name}"; } say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions
Quick Dart Primer: Functions say_hi(name) { return "Hi, ${name}"; }
say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions say_hi(name) { return "Hi, ${name}"; }
say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions say_hi(name) { return "Hi, ${name}"; }
say_hi("Bob"); // "Hi, Bob"
Quick Dart Primer: Functions say_hi(name) => "Hi, ${name}"; say_hi("Bob"); //
"Hi, Bob"
var say_hi = (name) => "Hi, ${name}"; say_hi("Bob"); // "Hi,
Bob" Quick Dart Primer: Anon. Functions
Oh, Ruby… I ♥ You So Much class Cookie attr_reader
:number_of_chips def initialize(num) @number_of_chips = num end end c = Cookie.new(1) c.number_of_chips => 1
Oh, Dart… I ♥ You So Much class Cookie {
var number_of_chips; Cookie(num) { number_of_chips = num; } }
Magic Instance Variables class Cookie { var number_of_chips; Cookie(num) {
number_of_chips = num; } }
Magic Instance Variables class Cookie { var number_of_chips; Cookie(this.number_of_chips); }
Magic Instance Variables class Cookie { var number_of_chips; Cookie(this.number_of_chips); }
> var cookie = new Cookie(12); > cookie.number_of_chips; // 12 > cookie.number_of_chips = 25; > cookie.number_of_chips; // 25
Magic Instance Variables class Cookie { var _calories; // ...
} > var cookie = new Cookie(); > cookie._calories; // Error! > cookie._calories = 25; // Error!
Getters and Setters class Cookie { var _calories; get calories
=> _calories / 3; set calories(v) { _calories = v; } } > var cookie = new Cookie(); > cookie.calories = 300; > cookie.calories; // 100
Optional Parameters class Cookie { var calories; Cookie({calories}) { this.calories
= calories; } } > c1 = new Cookie(calories: 300); > c2 = new Cookie();
Optional Parameters class Cookie { var calories, number_of_chips; Cookie({ this.calories,
this.number_of_chips }); } > c1 = new Cookie(calories: 300); > c1.calories; // 300
Optional Parameters class Cookie { var calories, number_of_chips; Cookie({ this.calories,
this.number_of_chips }); } > c2 = new Cookie(number_of_chips: 9); > c2.number_of_chips; // 9
Optional Parameters class Cookie { var calories, number_of_chips; Cookie({ this.calories,
this.number_of_chips: 2 }); } > c3 = new Cookie(); > c3.number_of_chips; // 2
Optional Parameters class Cookie { var calories, number_of_chips; Cookie([ this.calories,
this.number_of_chips]); } > c1 = new Cookie(120, 9); > c2 = new Cookie(120); > c3 = new Cookie();
Method Cascades cookie ..mix_it() ..stir_it() ..bake_it() ..eat_it();
Method Cascades cookie ..calories = 120 ..number_of_chips = 12 ..bake_time
= 30 ..deliciousness = 42;
Method Cascades bg.style ..position = 'absolute' ..top = '0px' ..left
= '0px' ..width = "${doc.offsetWidth}px" ..height = "${doc.clientHeight}px" ..backgroundColor = 'black' ..opacity = '0.8' ..zIndex = '1000';
Unit Tests test_create() { group("new DBs", () { setUp(removeFixtures); tearDown(removeFixtures);
test("creates a new DB", () {/*…*/}); }); }
Unit Tests test_create() { group("new DBs", () { setUp(removeFixtures); tearDown(removeFixtures);
test("creates a new DB", () {/*…*/}); }); }
Unit Tests // ... test("creates a new DB", () {
var db = new Dirty('test/test.db'); expect( new File('test/test.db').exists(), equals(true) ); });
test("can write to the DB", () { var db =
new Dirty('test/test.db'); db['everything'] = {'answer': 42}; db.close(expectAsync0(() { expect( new File('test/test.db').size(), greaterThan(0) ); })); }); Unit Tests
test("can write to the DB", () { var db =
new Dirty('test/test.db'); db['everything'] = {'answer': 42}; db.close(expectAsync0(() { expect( new File('test/test.db').size(), greaterThan(0) ); })); }); Unit Tests
Client-side Libraries import 'dart:html'; import 'dart:json'; import 'cookie.dart'; main() {
var cookie = new Cookie(12); }
Client-side Libraries class Cookie { var number_of_chips; Cookie(this.number_of_chips); }
Client-side Libraries library cookies; class Cookie { var number_of_chips; Cookie(this.number_of_chips);
}
Client-side Libraries import 'dart:html'; import 'dart:json'; import 'cookie.dart'; main() {
var cookie = new Cookie(12); }
Pub Packages $ cd public/scripts $ cat pubspec.yaml name: killer_app
dependencies: hipster_mvc: any $ pub install Resolving dependencies... Dependencies installed!
$ cd public/scripts $ cat pubspec.yaml name: killer_app dependencies: hipster_mvc:
any $ pub install Resolving dependencies... Dependencies installed! Pub Packages
Pub Packages $ cd public/scripts $ cat pubspec.yaml name: killer_app
dependencies: hipster_mvc: any $ pub install Resolving dependencies... Dependencies installed!
Pub Packages library cookie_model; import 'package:hipster_mvc/hipster_model. dart'; class Cookie extends
HipsterModel { Cookie(attributes) : super(attributes); }
Pub Packages • pub.dartlang.org • public git repositories • great
for local dev
Statically Typed Language
Statically Typed Language (but not really)
Statically Typed Language Sneakily
(Not Really) Static Typing class Cookie { var number_of_chips; Cookie(this.number_of_chips);
}
(Not Really) Static Typing class Cookie { int number_of_chips; Cookie(this.number_of_chips);
}
(Not Really) Static Typing class Cookie { int number_of_chips; Cookie(this.number_of_chips);
} var c1 = new Cookie(12); var c2 = new Cookie('salt'); print(""" c1: ${c1.number_of_chips} chips c2: ${c2.number_of_chips} chips""");
(Not Really) Static Typing class Cookie { int number_of_chips; Cookie(this.number_of_chips);
} c1: 12 chips c2: salt chips
$ dartanalyzer static_typing.dart 'String' is not assignable to 'int' 2:
var c1 = new Cookie(12); 3: var c2 = new Cookie('salt'); ~~~~~~ (Not Really) Static Typing
Dartdocs $ dartdoc cookie.dart
Dartdocs
Dartdocs /// A yummy, yummy food. class Cookie { ///
The number of chips in the /// cookie. The more the better. int number_of_chips; /// We do not support cookies /// without chips at this time. Cookie(this.number_of_chips); }
Dartdocs
Dartdocs
Dartdocs Documentation I didn't write
Dartdocs Documentation I didn't write
Dartdocs Class navigation
Dartdocs Search (client-side)
Dartdocs I ♥ Documentation
Dartdocs I ♥ Static Typing
I ♥ Dart
Thanks! Chris Strom @eee_c #pairwithme!!! Buy the book :) Also:
SPDY, Backbone.js, 3D Game Programming for Kids
Generative Constructors
Operators Overloading
Isolates
Futures