Haim Michael
October 9th, 2013

All logos, trade marks and brand names used in this presentation belong
to the respective owners.
Watch the lecture at http://youtu.be/4g3U6MZc92Q

LifeMichael.com

Dart Jump Start
●

Introduction

●

Optional Typing

●

Object Oriented Programming

●

Functional Programming

●

JavaScript Interoperability

●

Dart Packages Manager

●

Dart Evolution

●

Dart Criticism

●

Learning Resources

●

Questions & Answers

LifeMichael.com

Table of Content
●

Dart is an open source class based, object oriented,
optionally typed programming language that assists us
with the development of browser based one page web
applications.

●

We can execute the code that should run on the client
side either by using a web browser that supports Dart or
by compiling our code into JavaScript.

LifeMichael.com

Introduction
●

We can execute our code on the server side by using the
Dart virtual machine.

●

The syntax seems familiar both to those who are used to
JavaScript and to those who are used to JavaPHPC#.

LifeMichael.com

Introduction
●

The Dart programming language bridges the gap between the
JavaScript dynamic type system and the JavaC# static one.

●

The optional typing is available in variable declarations, function
parameters definitions and function return types.
void main()
{
int a = 4;
int b = 3;
var temp = a + b;
print("temp=$temp");
}

LifeMichael.com

Optional Typing
●

The Dart programming language uses classes and interfaces

●

similarly to Java, C# and PHP.

●

Dart supports single inheritance similarly to Java, C# and PHP.

●

Dart supports multiple interfaces implementation similarly to
Java, C# and PHP.

●

Similarly to Java, PHP and C# every class inherits (either
directly or indirectly) from the Object class.

LifeMichael.com

Object Oriented Programming
●

The classes can have public and private members. The
public accessibility is the default one.

●

Dart supports a special shorthand syntax for accessing
class properties, similarly to properties in C#

LifeMichael.com

Object Oriented Programming
class Rectangle
{
double _width;
double _height;
Rectangle(double w,double h)
{
width = w;
height = h;
}
get width => _width;
set width(size) => (size>0)?_width=size:_width=10.0;
get height => _height;
set height(size) => (size>0)?_height=size:_height=10.0;
area() => width * height;
perimeter() => 2*(width+height);
}

LifeMichael.com

Object Oriented Programming
main()
{
var ob = new Rectangle(3.2,4.4);
ob.width = 20.2;
ob.height = -4.1;
var area = ob.area();
print("area is $area");
}

LifeMichael.com

Object Oriented Programming
●

We can pass a function as an argument to another
function and we can assign a function to a variable.

●

The possibility to define anonymous functions and pass
them over as arguments to other functions simplifies the
code.

LifeMichael.com

Functional Programming
goodMorning(str) => print("Good Morning $str");
goodEvening(str) => print("Good Evening $str");
loop(func,name)
{
for(var i=1;i<=3;i++)
{
func(name);
}
}
main()
{
var myFunc = goodEvening;
loop(myFunc,"Danidin");
}

LifeMichael.com

Functional Programming
●

Dart allows us to interact with other parts of the web
document as the DOM and other code written in
JavaScript.

LifeMichael.com

JavaScript Interoperability
import 'dart:html';
void main() {
var ob = query("#sample_text_id");
ob.text = "Press Here";
ob.on.click.add(reverseText);
}
void reverseText(Event event) {
var text = query("#sample_text_id").text;
var buffer = new StringBuffer();
for (int i = text.length - 1; i >= 0; i--) {
buffer.add(text[i]);
}
query("#sample_text_id").text = buffer.toString();
}

LifeMichael.com

JavaScript Interoperability
●

Pub is Dart package manager. Pub assists us reusing
existing Dart code.

●

Pub handles versioning and dependency management
and ensures that our application runs on other machines
exactly as it runs on ours.
http://pub.dartlang.org

LifeMichael.com

Dart Package Manager
●

Dart was announced on October 12th 2011. The
developers of Dart seem to learn well from Java
mistakes (waiting with the production release, proper
development tools and neutralizing competitors).

●

During the past two years its development goes side by
side with the development of new Google powered
JavaScript libraries, such as AngularJS and Polymer.
Polymer

LifeMichael.com

Dart Evolution
“The growth of Dart might take us backward to the days
of proprietary vendor lock-in"
“There is a fragmentation risk in the evolution of a new
non standard programming language for the web"
“The optional typing damages the quality of the code"

Critics I Found on The Web

LifeMichael.com

Dart Criticism
●

Dart programming language official main website
https://www.dartlang.org

●

You can find the 'Dart Fundamentals' online course
available for free personal use at
http://abelski.lifemichael.com

●

Dart Developers Group on Facebook
https://www.facebook.com/groups/221793191216903/

LifeMichael.com

Learning Resources
●

Two courses you might find interesting include
Software Engineering in PHP
more info
Android 4.4 Java Applications Development
more info
HTML5 Cross Platform Mobile Applications
more info

●

If you enjoyed my lecture please leave me a comment
at http://speakerpedia.com/speakers/life-michael.
Thanks for your time!
Haim.

LifeMichael.com

Questions & Answers

Dart Jump Start

  • 1.
    Haim Michael October 9th,2013 All logos, trade marks and brand names used in this presentation belong to the respective owners. Watch the lecture at http://youtu.be/4g3U6MZc92Q LifeMichael.com Dart Jump Start
  • 2.
    ● Introduction ● Optional Typing ● Object OrientedProgramming ● Functional Programming ● JavaScript Interoperability ● Dart Packages Manager ● Dart Evolution ● Dart Criticism ● Learning Resources ● Questions & Answers LifeMichael.com Table of Content
  • 3.
    ● Dart is anopen source class based, object oriented, optionally typed programming language that assists us with the development of browser based one page web applications. ● We can execute the code that should run on the client side either by using a web browser that supports Dart or by compiling our code into JavaScript. LifeMichael.com Introduction
  • 4.
    ● We can executeour code on the server side by using the Dart virtual machine. ● The syntax seems familiar both to those who are used to JavaScript and to those who are used to JavaPHPC#. LifeMichael.com Introduction
  • 5.
    ● The Dart programminglanguage bridges the gap between the JavaScript dynamic type system and the JavaC# static one. ● The optional typing is available in variable declarations, function parameters definitions and function return types. void main() { int a = 4; int b = 3; var temp = a + b; print("temp=$temp"); } LifeMichael.com Optional Typing
  • 6.
    ● The Dart programminglanguage uses classes and interfaces ● similarly to Java, C# and PHP. ● Dart supports single inheritance similarly to Java, C# and PHP. ● Dart supports multiple interfaces implementation similarly to Java, C# and PHP. ● Similarly to Java, PHP and C# every class inherits (either directly or indirectly) from the Object class. LifeMichael.com Object Oriented Programming
  • 7.
    ● The classes canhave public and private members. The public accessibility is the default one. ● Dart supports a special shorthand syntax for accessing class properties, similarly to properties in C# LifeMichael.com Object Oriented Programming
  • 8.
    class Rectangle { double _width; double_height; Rectangle(double w,double h) { width = w; height = h; } get width => _width; set width(size) => (size>0)?_width=size:_width=10.0; get height => _height; set height(size) => (size>0)?_height=size:_height=10.0; area() => width * height; perimeter() => 2*(width+height); } LifeMichael.com Object Oriented Programming
  • 9.
    main() { var ob =new Rectangle(3.2,4.4); ob.width = 20.2; ob.height = -4.1; var area = ob.area(); print("area is $area"); } LifeMichael.com Object Oriented Programming
  • 10.
    ● We can passa function as an argument to another function and we can assign a function to a variable. ● The possibility to define anonymous functions and pass them over as arguments to other functions simplifies the code. LifeMichael.com Functional Programming
  • 11.
    goodMorning(str) => print("GoodMorning $str"); goodEvening(str) => print("Good Evening $str"); loop(func,name) { for(var i=1;i<=3;i++) { func(name); } } main() { var myFunc = goodEvening; loop(myFunc,"Danidin"); } LifeMichael.com Functional Programming
  • 12.
    ● Dart allows usto interact with other parts of the web document as the DOM and other code written in JavaScript. LifeMichael.com JavaScript Interoperability
  • 13.
    import 'dart:html'; void main(){ var ob = query("#sample_text_id"); ob.text = "Press Here"; ob.on.click.add(reverseText); } void reverseText(Event event) { var text = query("#sample_text_id").text; var buffer = new StringBuffer(); for (int i = text.length - 1; i >= 0; i--) { buffer.add(text[i]); } query("#sample_text_id").text = buffer.toString(); } LifeMichael.com JavaScript Interoperability
  • 14.
    ● Pub is Dartpackage manager. Pub assists us reusing existing Dart code. ● Pub handles versioning and dependency management and ensures that our application runs on other machines exactly as it runs on ours. http://pub.dartlang.org LifeMichael.com Dart Package Manager
  • 15.
    ● Dart was announcedon October 12th 2011. The developers of Dart seem to learn well from Java mistakes (waiting with the production release, proper development tools and neutralizing competitors). ● During the past two years its development goes side by side with the development of new Google powered JavaScript libraries, such as AngularJS and Polymer. Polymer LifeMichael.com Dart Evolution
  • 16.
    “The growth ofDart might take us backward to the days of proprietary vendor lock-in" “There is a fragmentation risk in the evolution of a new non standard programming language for the web" “The optional typing damages the quality of the code" Critics I Found on The Web LifeMichael.com Dart Criticism
  • 17.
    ● Dart programming languageofficial main website https://www.dartlang.org ● You can find the 'Dart Fundamentals' online course available for free personal use at http://abelski.lifemichael.com ● Dart Developers Group on Facebook https://www.facebook.com/groups/221793191216903/ LifeMichael.com Learning Resources
  • 18.
    ● Two courses youmight find interesting include Software Engineering in PHP more info Android 4.4 Java Applications Development more info HTML5 Cross Platform Mobile Applications more info ● If you enjoyed my lecture please leave me a comment at http://speakerpedia.com/speakers/life-michael. Thanks for your time! Haim. LifeMichael.com Questions & Answers