Top Banner
Dart Another tool in the toolbox
23

Dart: Another Tool in the Toolbox

Dec 25, 2014

Download

Internet

rubygeek

I give an overview in dart and highlight the things I think are so cool about Dart. At the end I gave a demo of a web application using Dart and Polymor Web Components.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dart: Another Tool in the Toolbox

Dart Another tool

in the toolbox

Page 2: Dart: Another Tool in the Toolbox

http://blog.sethladd.com/2013/09/forms-http-servers-and-polymer-with-dart.html

Client and ServerWe got both kinds, Client and Server!!!

Page 3: Dart: Another Tool in the Toolbox

Who uses dart• Google - Fiber, Apps, Election

• Netflix - Security Monkey, integration with AWS

• Soundtrap - Music Recording with browser and WebRTC

• Blossom - Lean project mgmt tool

• SonarDesign - where Jesse works! :)

Page 4: Dart: Another Tool in the Toolbox

How do I use it?• Run in Chromium Browser with DartVM

• Compile to javascript

Page 5: Dart: Another Tool in the Toolbox

Language Features

Page 6: Dart: Another Tool in the Toolbox

Data types• Num (base abstract type):

• int double (concrete types for num)

• String

• Bool

• List - no arrays !!

• Map

Page 7: Dart: Another Tool in the Toolbox

Bool• Unlike JavaScript, 1 is not true

• True is true

• Everything else is false

Page 8: Dart: Another Tool in the Toolbox

Strongly typed / Optionally typed

Page 9: Dart: Another Tool in the Toolbox

Interpolation

Page 10: Dart: Another Tool in the Toolbox

Classes

Page 11: Dart: Another Tool in the Toolbox

Private, Getters/Setters

Page 12: Dart: Another Tool in the Toolbox

Constructor

Page 13: Dart: Another Tool in the Toolbox

Methods - Positional Parameters• optional parameters specified with [ ]

• defaults with =

Page 14: Dart: Another Tool in the Toolbox

Methods - Named Parameters• named parameters specified with {}

• defaults with :

Page 15: Dart: Another Tool in the Toolbox

name (x) => expression

Shorthand function

Page 16: Dart: Another Tool in the Toolbox

Anonymous Function

FYI: fold is like inject/reduce in ruby

Use the shorthand syntax

Page 17: Dart: Another Tool in the Toolbox

Generics

Page 18: Dart: Another Tool in the Toolbox

Mixins

Page 19: Dart: Another Tool in the Toolbox

Functional

http://www.infoq.com/presentations/dart-introduction

Page 20: Dart: Another Tool in the Toolbox

Interfaces• Not strict, only warnings if you don't implement

all the methods

Page 21: Dart: Another Tool in the Toolbox

Dart VM Modes

• Checked - annotations (int, string, etc) throw exceptions if given invalid data

• Production - type annotations are ignored

Page 22: Dart: Another Tool in the Toolbox

Console Apps• import "dart:io"

• Can't use in web pages

• File operations

• synchronous

• asynchronous

Page 23: Dart: Another Tool in the Toolbox

Web Applications

demo