Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Who am I? ๏ Founder @ Dynamatik ๏ Co-Founder @ Ember Chat ๏ Engineer @ Kobo ๏ @FaisalAbid ๏ [email protected] - Ask me anything about Node, AngularJS, Dart, Polymer, and Android.

Slide 3

Slide 3 text

About the talk ๏ Split into three parts. ๏ For someone who has not done Dart and Polymer before. ๏ Goal is to inspire you to go out, learn Dart & Polymer and rule the world. ๏ Part 1. Dart introduction to basic language concepts ๏ Part 2. Quick rundown of Web components & Polymer ๏ Part 3. Dart + Polymer and how they love each other

Slide 4

Slide 4 text

But first Let’s play a game

Slide 5

Slide 5 text

Guess the language

Slide 6

Slide 6 text

! public String Hello(){ return "World"; }

Slide 7

Slide 7 text

! public String Hello(){ return "World"; } Java

Slide 8

Slide 8 text

! function Hello(){ return "World"; }

Slide 9

Slide 9 text

! function Hello(){ return "World"; } Javascript

Slide 10

Slide 10 text

! String Hello(){ return "World"; }

Slide 11

Slide 11 text

! String Hello(){ return "World"; } Dart!

Slide 12

Slide 12 text

You already know Dart* *95% of it at least

Slide 13

Slide 13 text

1 Dart

Slide 14

Slide 14 text

What is Dart & Why should I care? ๏ Dart is a new platform and language by Google. ๏ Dart is for “Scalable web app engineering”

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

“Scalable web app engineering” What does that mean?

Slide 20

Slide 20 text

Scalable web app engineering ๏ Javascript is “Scalable” to an extent • RequireJS/AMD modules • Frameworks like Backbone, Ember.js, Angular.js • JQuery, Zepto

Slide 21

Slide 21 text

Javascript is the root of all evil* *a little bit dramatic, but gets the point across

Slide 22

Slide 22 text

Scalable web app engineering ๏ Dart is built for scale • Optional type checking - I <3 typed objects • Single threaded “Isolate” concept for server apps. Web workers for client. • Objects, Classes, Polymorphism • Easy async, less messy callbacks • Many years of programming language research • High performance VM, Dartium • Compile straight to JS for cross browser compatibility

Slide 23

Slide 23 text

All while keeping the language easy to develop in.

Slide 24

Slide 24 text

All while keeping the language easy to develop in. Because all that scale stuff is cool, but this is what really matters.

Slide 25

Slide 25 text

class Conference { String name; num attendees; Conference(String name, num attendees) { this.name = name; this.attendees = attendees; } } // then later var OSCON = new Conference("OSCON", 5800); Example Class in Dart

Slide 26

Slide 26 text

Dart IDE Tour

Slide 27

Slide 27 text

Dart IDE Tour

Slide 28

Slide 28 text

Dart Package Manager

Slide 29

Slide 29 text

Dart IDE Tour

Slide 30

Slide 30 text

Dart IDE Tour

Slide 31

Slide 31 text

OOP ๏ Dart is Object Oriented. ๏ Makes web development sane. ๏ Concept of libraries to pair multiple classes together. ๏ One .dart file can have multiple classes.

Slide 32

Slide 32 text

Dart OOP Example

Slide 33

Slide 33 text

OOP - summary ๏ Part / Part of makes easy to separate “libraries” ๏ Constructors can easily set instance variables ๏ Control visibility with _ ๏ Easy one line methods with => ๏ Listen to events with .listen

Slide 34

Slide 34 text

Optionally Typed ๏ Dart is optionally typed. ๏ For Public API’s / Public Methods - Use Type ๏ For internal method implementations, use var. • Dart IDE will make use of type info also. Easy code assist. • “Explicit type annotations are usually just visual noise.”

Slide 35

Slide 35 text

Dart Typed Example

Slide 36

Slide 36 text

Dart > Javascript

Slide 37

Slide 37 text

Async / Future ๏ One of the most powerful features of Dart ๏ Dart is single threaded, blocking code blocks! ๏ Dart futures lets you perform async operations. I.e HTTP

Slide 38

Slide 38 text

Dart Future Example

Slide 39

Slide 39 text

Async / Future - Recap ๏ One of the most powerful features of Dart ๏ Dart is single threaded, blocking code blocks! ๏ Dart futures lets you perform async operations. I.e HTTP ๏ Futures make it easy to avoid callback hell and keep syntax simple. ๏ Almost one line API calls. no callbacks needed

Slide 40

Slide 40 text

Dart Everywhere ๏ You can write your Dart apps on the server side also! ๏ Dart on the full stack! Front-end and backend. ๏ Use classes, futures and everything you’ve learned

Slide 41

Slide 41 text

Simple Dart:io Example

Slide 42

Slide 42 text

Dart for web ๏ Ran through simple but powerful examples. ๏ Dart makes web development easy. ๏ Dart is built to scale, with OOP principals, Async programming made easy and simple to use syntax. Making Dart web apps is easy. ๏ But what’s this polymer thing about?

Slide 43

Slide 43 text

2 Polymer / Web components

Slide 44

Slide 44 text

What are web components? ๏ Next generation of encapsulation for the web. ๏ Build your own tag, hide the implementation details.

Slide 45

Slide 45 text

Whats the shadow DOM? ๏ Shadow DOM hides the web component implementation from the DOM. ๏ I.e shows up as and not a series of divs. ๏ Ready in firefox, chrome, opera, and their mobile counterparts. ๏ Not in Safari. ๏ Polyfills ready for older browsers and Safari. Mileage may vary

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Now what’s Polymer then? ๏ Truthfully the web component spec is sometimes messy ๏ Hard to implement on its own. ๏ Polymer wraps all this up in a nice abstraction layer. By Google ๏ Works wherever Web components/ Shadow dom works.

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Can I use Polymer with only Dart? ๏ No! Polymer can be used with Javascript. In fact it’s first written for JS. ๏ Dart has a feature parity port by Google. ๏ pub : polymer ๏ pub : paper-elements ๏ Polymer is better with Dart. You feel like you are coding for the future.

Slide 51

Slide 51 text

3 Dart meet Polymer

Slide 52

Slide 52 text

How do you use Polymer with Dart ๏ Starter project makes it easy to get started. ๏ Transformer gets polymer all ready to rock.

Slide 53

Slide 53 text

Dart / Polymer Example

Slide 54

Slide 54 text

Simple data binding in Polymer ๏ You want your components to do something and take attributes ๏ Databinding is simple with polymer. ๏ Lets take a look!

Slide 55

Slide 55 text

Dart / Polymer Databinding

Slide 56

Slide 56 text

Simple data binding in Polymer ๏ You want your components to do something and take attributes ๏ Databinding is simple with polymer. ๏ @published - is two way binding ๏ @observable - is one way binding

Slide 57

Slide 57 text

Advanced data binding in Polymer ๏ Databind on lists too!

Slide 58

Slide 58 text

! @CustomTag(‘speaker-list') class SpeakerList extends PolymerElement { final List speakers = toObservable(["Speaker One", "Speaker Two", "Speaker Three"]); ! SpeakerList() : super.created(); } ! [ . . . ] !
  • {{speaker}}
  • Example list data binding in Dart

    Slide 59

    Slide 59 text

    Advanced data binding in Polymer ๏ Databind on lists too! ๏ DAMN THIS IS EASY!!!!

    Slide 60

    Slide 60 text

    Material Design & Polymer ๏ Google introduced this at Google IO ๏ Sexy fluid new UI components for the web & mobile. ๏ “Paper-elements” is a package ready to be used by Dart. In fact many examples have used paper-elements already!

    Slide 61

    Slide 61 text

    Material Design / Polymer Example

    Slide 62

    Slide 62 text

    Closing Thoughts ๏ Dart is ready for prime time. version 1.5.2 ๏ Polymer still in beta for Dart, but “pretty” stable. ๏ Dart brings sanity to web development. ๏ Polymer/Web components brings proper modularity to web development. ๏ Dart is moving full steam ahead, adopted heavily by Google. ๏ It’s not going anywhere, so embrace change and lets rule the world.

    Slide 63

    Slide 63 text

    Thank you @FaisalAbid - [email protected] Title screen by Sam Beck - two-thirty.tumblr.com Thanks to cloudimage.io for helping me out with my Image CDN needs. Check them out!

    Slide 64

    Slide 64 text

    No content