jazoon'13 - paul brauner - a backend developer meets the web: my dart experience

120
My Dart Experience Paul Brauner

Upload: jazoon13

Post on 12-May-2015

32.136 views

Category:

Education


2 download

DESCRIPTION

http://guide13.jazoon.com/#/submissions/124

TRANSCRIPT

Page 1: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

My Dart ExperiencePaul Brauner

Page 2: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Page 3: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• PhD in Logic / Types

• Postdoc in Languages

• Now at Google

|

About Me

Page 4: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• PhD in Logic / Types

• Postdoc in Languages

• Now at Google

|

About Me

Page 5: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• PhD in Logic / Types

• Postdoc in Languages

• Now at Google

|

About Me

map f (x:xs) = f x : map f xs

for (x <- xs) f(x)

Page 6: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• PhD in Logic / Types

• Postdoc in Languages

• Now at Google

|

About Me

map f (x:xs) = f x : map f xs

for (x <- xs) f(x)

Page 7: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart Contributor

Page 8: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Writing backends

• Writing background jobs (mapreduce)

• Mostly Java, C++

|

My Work Involves

Page 9: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Code navigation, completion, static errors

• Libraries / Modules

• Generated documentation

• Reasonable performance

|

I Take for Granted

Page 10: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

I ♥ the Web Platform

Page 11: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

I ♥ the Web Platform

Page 12: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

I Web Development *

* except for fast edit-refresh cycle, that's awesome

Page 13: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

> [] + {}[object Object]> {} + []0> {} + {}NaN

WAT (h/t Gary Bernhardt)

Page 14: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

WAT - Reloaded

var x = "top-level";function foo() { if (true) { var x = "inside-if"; } console.log(x);}foo();

Page 15: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

WAT - Reloaded

var x = "top-level";function foo() { if (true) { var x = "inside-if"; } console.log(x);}foo();

inside-if

Page 16: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Libraries?

Page 17: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Libraries?

Page 18: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Libraries?

Page 19: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Linker?

Page 20: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Linker?

Page 21: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Web Development?

Page 22: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Page 23: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Language and Libraries

• Tools

• Virtual Machine

• Compiles to Javascript

|

Dart

Page 24: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Targets All Browsers

.dart

Page 25: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Targets All Browsers

.dart

Virtual Machine

edit/refresh

Page 26: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Targets All Browsers

.dart

Virtual Machine

dart2js

.js

edit/refresh deploy

Page 27: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• CoffeScript & Friends: only improve syntax

• Closure: structure but same semantics

• GWT: good but slow edit/refresh cycle (fixed in

upcoming version!)

|

Alternatives

Page 28: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Semantics

• Structure

• Fast edit/refresh cycle

|

Dart

Page 29: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart in a Nutshell

class Point {

double x, y;

Point(this.x, this.x);

toString() => "($x, $y)";}

Page 30: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart in a Nutshell

class Point {

double x, y;

Point(this.x, this.x);

toString() => "($x, $y)";}

Class-based

Page 31: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart in a Nutshell

class Point {

double x, y;

Point(this.x, this.x);

toString() => "($x, $y)";}

Class-based

Optionally typed

Page 32: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart in a Nutshell

class Point {

double x, y;

Point(this.x, this.x);

toString() => "($x, $y)";}

Class-based

Optionally typed

Terse syntax

Page 33: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart in a Nutshell

class Point {

double x, y;

Point(this.x, this.x);

toString() => "($x, $y)";}

Class-based

Optionally typed

Terse syntax

Page 34: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Dart in a Nutshell

class Point {

double x, y;

Point(this.x, this.x);

toString() => "($x, $y)";}

Class-based

Optionally typed

Terse syntax

Page 35: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Unsurprising Semantics

Page 36: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Only true is truthy

• There is no undefined, only null

• No type coercion with ==, +

|

Clean Semantics - Examples

Page 37: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Missing Getter

"hello".missing // ??

Page 38: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Missing Getter

"hello".missing // ??

Class 'String' has no instance getter 'missing'.

NoSuchMethodError : method not found: 'missing'Receiver: "hello"Arguments: []

Page 39: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Index out of Range

[][42] // ??

Page 40: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Index out of Range

[][42] // ??

RangeError: 42

Page 41: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Variable Scope

var x = "top-level";void foo() { if (true) { var x = "inside-if"; } print(x);}void main() { foo(); } // ??

Page 42: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Variable Scope

var x = "top-level";void foo() { if (true) { var x = "inside-if"; } print(x);}void main() { foo(); } // ??

top-level

Page 43: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Clean Semantics – Scope of this

class App {

App(button) { button.onClick.listen((e) => this.foo()); }

foo() { … }}

Page 44: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Structure

Page 45: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Structure - Libraries

library game;import 'dart:math';

class Game { … }play(Game game) { … }

_secret(Game game) { … }

Module system

Page 46: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Structure - Libraries

library game;import 'dart:math';

class Game { … }play(Game game) { … }

_secret(Game game) { … }

Module system

Scoped definitions

Page 47: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Structure - Libraries

library game;import 'dart:math';

class Game { … }play(Game game) { … }

_secret(Game game) { … }

Module system

Scoped definitions

Private definition

Page 48: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Structure - Packages

name: parsers version: 0.13.6

dependencies: persistent: '>=0.7.0 <0.8.0' dev_dependencies: unittest: any

Page 49: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Optional types

• Mixins (class A extends B with C)

• Method cascades (foo..bar(1)..baz(2))

• Future proof APIs

|

Towards a Better Language

Page 50: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Optional types

• Mixins (class A extends B with C)

• Method cascades (foo..bar(1)..baz(2))

• Future proof APIs

|

Towards a Better Language

Page 51: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates double angle, radius; Point(this.angle, this.radius);

… }

How do we prevent clients from breaking?

Page 52: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates

get x => … set x(value) => …

operator [](int index) => …

toString([bool asJson]) => … }

Page 53: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates

get x => … set x(value) => …

operator [](int index) => …

toString([bool asJson]) => … }

Getters / Setters

Page 54: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates

get x => … set x(value) => …

operator [](int index) => …

toString([bool asJson]) => … }

Getters / Setters

Operator overriding

Page 55: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates

get x => … set x(value) => …

operator [](int index) => …

toString([bool asJson]) => … }

Getters / Setters

Operator overriding

Optional arguments

Page 56: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates

factory Point(x, y) { return new Point.polar(…); }

Point.polar(angle, radius) { … }}

Factoryconstructors

Page 57: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Future Proof APIs

class Point { // now polar coordinates

factory Point(x, y) { return new Point.polar(…); }

Point.polar(angle, radius) { … }}

Factoryconstructors

Named constructors

Page 58: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Modern, consistent library (collections, typed

HTML bindings, futures, streams, ...)

• JS interoperability

• Server-side programming

|

Not Just a Language

Page 59: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Flip It!

Page 60: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Flip It!

Snappy UIOffline playing

Page 61: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Flip It!

Snappy UIOffline playing

Validation required

Page 62: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Code Reuse

class Board { Board.decode(str) { … } String encode() { … } bool validate() { … }}

common.dart server.dart

client.dart

import

import

Page 63: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

3rd Party Libraries

Bootstrap for Dart

Google APIs client libs

OAuth2 authentication

PostgreSQL driver

Web Server

Clientside routing

Page 64: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

3rd Party Libraries

Page 65: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Can I Have my Reader Now?

Page 66: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Can I Have my Reader Now?

Page 67: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• "Widgets" are a bunch of nested divs

• Unique IDs leak all over the place

• CSS leaks to parents / children

|

The Problem with HTML

Page 68: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• "Widgets" are a bunch of nested divs

• Unique IDs leak all over the place

• CSS leaks to parents / children

|

The Problem with HTML

Page 69: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• "Widgets" are a bunch of nested divs

• Unique IDs leak all over the place

• CSS leaks to parents / children

|

The Problem with HTML

Page 70: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

MVC Boilerplateclass Model { StreamController _onCurrentBoardChanged = new StreamController(); StreamController _onPreviousBoardChanged = new StreamController(); StreamController _onCurrentPathChanged = new StreamController(); StreamController _onPreviousPathChanged = new StreamController(); StreamController _onStateChanged = new StreamController(); StreamController _onUserInfoChanged = new StreamController(); StreamController _onSignInStatusChanged = new StreamController();

void _initStreams() { onCurrentBoardChanged = _onCurrentBoardChanged.stream.asBroadcastStream(); onPreviousBoardChanged = _onPreviousBoardChanged.stream.asBroadcastStream(); onCurrentPathChanged = _onCurrentPathChanged.stream.asBroadcastStream(); onPreviousPathChanged = _onPreviousPathChanged.stream.asBroadcastStream(); onStateChanged = _onStateChanged.stream.asBroadcastStream(); onUserInfoChanged = _onUserInfoChanged.stream.asBroadcastStream(); onSignInStatusChanged = _onSignInStatusChanged.stream.asBroadcastStream(); }

void _currentBoardChanged() { _onCurrentBoardChanged.add(null); }

… }

Page 71: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Web Components

Page 72: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Web Components

<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>

Page 73: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Elements

<custom-element>

Structure Behavior Styles

<div> <input> <p> <span></span> </p></div>

tag.verifyAccount();<style> p { color: red; }</style>

Page 74: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Reusability

Custom Element

HTML Page HTML Page HTML Page

import import import

Page 75: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Based on emerging web standards

• Browser vendors interested

• Already partially implemented!

|

Future Proof

Page 76: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Page 77: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Polymer: Web Components Today

Polymer.dart

Page 78: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Declaration

<polymer-element name="my-message">

</polymer-element>

Page 79: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Declaration

<polymer-element name="my-message"> <template>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content> </div> </template>

</polymer-element>

Structure

Page 80: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Declaration

<polymer-element name="my-message"> <template> <style> #frame { border: 1px solid black; } </style>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content> </div> </template>

</polymer-element>

Structure

Style

Page 81: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Declaration

<polymer-element name="my-message"> <template> <style> #frame { border: 1px solid black; } </style>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content> </div> </template>

<script type="application/dart" src="my_message.dart"></script></polymer-element>

Behavior

Structure

Style

Page 82: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<head> <link rel="import" href="my_message.html"> </head>

Import

Page 83: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<head> <link rel="import" href="my_message.html"> </head>

<body>

<my-message> <span class="subject">Hello</span> <p>How are you?</p> </my-message> </body>

Import

Instantiation

Page 84: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<head> <link rel="import" href="my_message.html"> </head>

<body> <div id="frame">This won't be framed</div> <my-message> <span class="subject">Hello</span> <p>How are you?</p> </my-message> </body>

Encapsulation

Import

Instantiation

Page 85: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

Page 86: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation<my-message> <span class="subject">Hello</span> <p>How are you?</p></my-message>

Page 87: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation<my-message> <span class="subject">Hello</span> <p>How are you?</p></my-message>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content></div>

Page 88: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation<my-message> <span class="subject">Hello</span> <p>How are you?</p></my-message>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content></div>

Page 89: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<style> #frame { border: 1px solid black; }</style>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content></div>

Page 90: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<style> #frame { border: 1px solid black; }</style>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content></div>

Page 91: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<style> #frame { border: 1px solid black; }</style>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content></div>

<div id="frame">This won't be framed</div>

Page 92: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Custom Element Instantiation

<style> #frame { border: 1px solid black; }</style>

<div id="frame"> <b>Subject: </b><content select=".subject"></content> <content select="p"></content></div>

<div id="frame">This won't be framed</div>

Page 93: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() {

… this.children …

}}

Page 94: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() {

… this.children …

}}

Page 95: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() {

… this.children …

}}

Page 96: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() {

… this.children …

}}

Page 97: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() {

… this.children …

}}

Which ones?

Page 98: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Shadow DOM

shadow root

b content content

my-message

span p

"Hello" "How are you?" "Subject:"

div

Page 99: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() { }}

Page 100: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() { SpanElement subject = host.query('.subject'); subject.text = subject.text.toUpperCase(); }}

DOM

Page 101: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

@CustomTag('my-message')class MyMessage extends PolymerElement { enteredView() { SpanElement subject = host.query('.subject'); subject.text = subject.text.toUpperCase(); DivElement frame = shadowRoot.query('#frame'); frame.style.borderWidth = '3px'; }}

Shadow DOM

DOM

Page 102: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Behavior

Uppercase3px

Page 103: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Declarative Model-View-*

• Supports two-way bindings out of the box

|

Data Binding

Page 104: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Data Binding<polymer-element name="click-counter"> <template> <button on-click="increment">Click Me</button> <p>You clicked the button {{count}} times.</p> </template> </polymer-element>

Page 105: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Data Binding<polymer-element name="click-counter"> <template> <button on-click="increment">Click Me</button> <p>You clicked the button {{count}} times.</p> </template> </polymer-element>

Page 106: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Data Binding<polymer-element name="click-counter"> <template> <button on-click="increment">Click Me</button> <p>You clicked the button {{count}} times.</p> </template> </polymer-element>

Page 107: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Data Binding

@CustomTag('click-counter')class ClickCounterElement extends PolymerElement { @observable int count = 0; void increment(Event e, var detail, Node target) { count += 1; }}

<polymer-element name="click-counter"> <template> <button on-click="increment">Click Me</button> <p>You clicked the button {{count}} times.</p> </template> <script src="click_counter.dart" type="…" ></script></polymer-element>

Page 108: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Data Binding

@CustomTag('click-counter')class ClickCounterElement extends PolymerElement { @observable int count = 0; void increment(Event e, var detail, Node target) { count += 1; }}

<polymer-element name="click-counter"> <template> <button on-click="increment">Click Me</button> <p>You clicked the button {{count}} times.</p> </template> <script src="click_counter.dart" type="…" ></script></polymer-element>

Page 109: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Real World Example

data List<A> = Nil | Cons(A x, List<A> xs)

class List<A> { … }class Nil<A> extends List<A> { … }class Cons<A> extends List<A> { … }

Page 110: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Real World Example

Page 111: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Real World Example

<h2>Define</h2><textarea value='{{input}}'></textarea>

Page 112: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Real World Example

<label> <input type='checkbox' checked='{{finalFields}}'> final fields</label>

Page 113: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Real World Example

<h2>Profit</h2><code> <pre id='generated'> {{generated}} </pre></code>

Page 114: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Real World Example

<h2>Profit</h2><code> <pre id='generated'> {{generated}} </pre></code>

String get generated { final config = new Config(finalFields, … ); return generate(input, config);}

Page 115: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Can I have my Reader Now?

Page 116: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Can I have my Reader Now?

YES!

Page 117: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

• Haskell backend

• Polymer.dart* frontend

|

Bringing Reader Back to Life

* actually its ancestor

Page 118: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

Bringing Reader Back to Life

Page 119: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

|

http://dartlang.org

Page 120: JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience

Thanks for the attention!

Follow me on G+ (Paul Brauner)[email protected]

https://github.com/polux