SlideShare una empresa de Scribd logo
1 de 22
Dart

Iván Zaera Avellón
Co: izaera@gmail.com
Tw: @izaera
Table of contents
●

Language features

●

Testing

–

Data typing

–

Tests

–

Specific language constructions

–

Mocks

–

Modularity and visibility

–

Mixins

–

Arithmetic

●

More resources

Concurrency model
–

Async, Futures, Completers

–

Isolates

Development tools

–
●

–

Dart project's management

–

Libraries and APIs

–

Code example: cipher library
Introduction
Language features
Data typing
●

Optional typing

●

Dynamic keyword

●

Implicit interfaces

●

Implements and extends are interchangeable

●

Is and is! operator

●

Checked runtime mode
Specific language constructions
(1/2)
●

Cascade .. operator

●

Closures

●

One line functions (=>)

●

Optional arguments

●

Named arguments
Specific language constructions
(2/2)
●

Factory constructors

●

Named constructors

●

Initialization of fields with this. syntax

●

Getters, setters, and final

●

Const
Modularity and visibility
●

Libraries and parts

●

Visibility
–

Public

–

Library private

●

Concise private modifier: _

●

Cannot extend library private classes
Mixins
●

Orthogonal functionality

●

Used where OO is-a relation does not apply

●

Keyword: with

●

Only static mixins, not runtime (like Groovy's
metaClass, for instance)
Arithmetic
●

Base num type with double and int subtypes

●

All nums are signed

●

●
●

Integers have infinite precision (VM handles
two internal subtypes for efficiency)
Doubles are stored in IEEE format
Integers are implemented as doubles when
compiled to Javascript :-(
Concurrency model
Async, Futures, Completers
●

Async execution due to event loop (like JS)

●

Futures
–

–
●

Promise to provide a result of some computation some
time in the future
Difficult and cumbersome error handling

Completers
–

Low level construction to signal Future finalization

–

Should be used with care because makes error handling
more difficult than Futures
Isolates
●

Alternative to threads

●

Message passing paradigm
–

Shared memory not allowed

–

Use SendPort for sending messages

●

Less error prone

●

But less efficient
Testing
Tests
●

DSL: group(), test(), expect()

●

Matchers similar to Hamcrest Java library
void main() {
group( “converters:”, () {
test( "toUint32()", () {
expect( toUint32( 0x100000000 ), 0x00000000 );
expect( toUint32( -1 ), 0xFFFFFFFF );
});
});
}
Mocks
●

Mock by extending Mock class

class MockObjectory extends Mock implements Objectory {}
test( "getById() llama a Objectory.findOne() con la query correcta", () {
final id = "test_object_id";
final db = new MockObjectory();
final mockEntity = new MockEntity();
db.when( callsTo("findOne",anything) ).alwaysReturn( new Future.value(mockEntity) );
final dao = new TestObjectoryDao( "collection", db );
return dao.getById(id).then( (entity) {
var query = db.getLogs( callsTo("findOne", anything ) ).first.args[0].toString();
expect( query, equals("ObjectoryQueryBuilder(collection {_id: ObjectId(${id})})") );
});
});
More resources
Development tools
●

Dart editor
–
–

Static analyzer

–
●

Lightweight
Refactor tools

Dart Javascript compiler
–
–

●

Tree shaking
Minifying

Pub for dependency handling
Dart project's management
●

Two mailing lists:
–
–

●

misc@dartlang.org : for common questions
web@dartlang.org : for client side framework (Polymer) questions

Bugtracking
–

●

http://dartbug.com : redirects to Google Code

Version control system
–
–

●

http://github.com/...
Latest commits: https://code.google.com/p/dart/source/list

Standardization
–

ECMA is working on Dart's standard

–

http://www.ecma-international.org/memento/TC52.htm
Libraries and APIs (1/2)
●

dart:async

●

dart:chrome (client)

●

dart:collection

●

dart:core

●

dart:html (client)

●

dart:indexed_db (client)

●

dart:io (server)

●

dart:isolate

●

dart:json

●

dart:math

●

dart:mirrors

●

dart:svg (server)

●

dart:typed_data

●

dart:utf

●

dart:web_audio (client)

●

dart:web_gl (client)

●

dart:web_sql (client)
Libraries and APIs (2/2)
●

args: a library to handle command line arguments

●

crypto: a library with hash algorithms

●

fixnum: fixed size ints (32 and 64 bits)

●

intl: I18N support

●

logging: standard logging

●

meta: meta annotations library (for example: @deprecated y @override).

●

serialization: object serialization support

●

unittest: unit testing library

●

mock: mocking library for unit testing (similar to mockito)

●

matchers: matchers library for unit testing (similar to Hamcrest)
Code example: cipher library
●

Cryptography library

●

Code based on Bouncy Castle java library

●

https://github.com/izaera/cipher

Más contenido relacionado

La actualidad más candente

An Overview of the Java Programming Language
An Overview of the Java Programming LanguageAn Overview of the Java Programming Language
An Overview of the Java Programming LanguageSalaam Kehinde
 
C# Starter L02-Classes and Objects
C# Starter L02-Classes and ObjectsC# Starter L02-Classes and Objects
C# Starter L02-Classes and ObjectsMohammad Shaker
 
javascript objects
javascript objectsjavascript objects
javascript objectsVijay Kalyan
 
Introduction to Type Script by Sam Goldman, SmartLogic
Introduction to Type Script by Sam Goldman, SmartLogicIntroduction to Type Script by Sam Goldman, SmartLogic
Introduction to Type Script by Sam Goldman, SmartLogicSmartLogic
 
JavaScript Basics - GameCraft Training
JavaScript Basics - GameCraft TrainingJavaScript Basics - GameCraft Training
JavaScript Basics - GameCraft TrainingRadoslav Georgiev
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - ObjectsWebStackAcademy
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharphmanjarawala
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpRaga Vahini
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C SurvivesS Akai
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...GeeksLab Odessa
 
Session 08 - OOP with Java - continued
Session 08 - OOP with Java - continuedSession 08 - OOP with Java - continued
Session 08 - OOP with Java - continuedPawanMM
 
DIDUCE: ICSE-2002 presentation
DIDUCE: ICSE-2002 presentationDIDUCE: ICSE-2002 presentation
DIDUCE: ICSE-2002 presentationhangal
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scalaRuslan Shevchenko
 

La actualidad más candente (19)

An Overview of the Java Programming Language
An Overview of the Java Programming LanguageAn Overview of the Java Programming Language
An Overview of the Java Programming Language
 
C# Starter L02-Classes and Objects
C# Starter L02-Classes and ObjectsC# Starter L02-Classes and Objects
C# Starter L02-Classes and Objects
 
Java Day-5
Java Day-5Java Day-5
Java Day-5
 
JavaScript Data Types
JavaScript Data TypesJavaScript Data Types
JavaScript Data Types
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
Introduction to Type Script by Sam Goldman, SmartLogic
Introduction to Type Script by Sam Goldman, SmartLogicIntroduction to Type Script by Sam Goldman, SmartLogic
Introduction to Type Script by Sam Goldman, SmartLogic
 
JavaScript Basics - GameCraft Training
JavaScript Basics - GameCraft TrainingJavaScript Basics - GameCraft Training
JavaScript Basics - GameCraft Training
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
 
Java
Java Java
Java
 
Session 08 - OOP with Java - continued
Session 08 - OOP with Java - continuedSession 08 - OOP with Java - continued
Session 08 - OOP with Java - continued
 
DIDUCE: ICSE-2002 presentation
DIDUCE: ICSE-2002 presentationDIDUCE: ICSE-2002 presentation
DIDUCE: ICSE-2002 presentation
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 
JavsScript OOP
JavsScript OOPJavsScript OOP
JavsScript OOP
 
Java Advanced Features
Java Advanced FeaturesJava Advanced Features
Java Advanced Features
 

Similar a Dart language guide for developers

Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java DevelopersMartin Ockajak
 
Mockist vs. Classicists TDD
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDDDavid Völkel
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
JSLounge - TypeScript 소개
JSLounge - TypeScript 소개JSLounge - TypeScript 소개
JSLounge - TypeScript 소개Reagan Hwang
 
みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」techtalkdwango
 
第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScriptTakuya Fujimura
 
Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2Empatika
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: KotlinEvolve
 
NLJUG University Sessie: Java Reborn, Powered by Ordina
NLJUG University Sessie: Java Reborn, Powered by OrdinaNLJUG University Sessie: Java Reborn, Powered by Ordina
NLJUG University Sessie: Java Reborn, Powered by OrdinaMartijn Blankestijn
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform researchVasil Remeniuk
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform ResearchVasil Remeniuk
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David SzakallasDatabricks
 
Core2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfCore2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfThchTrngGia
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...Vladimir Ivanov
 
Intro to kotlin 2018
Intro to kotlin 2018Intro to kotlin 2018
Intro to kotlin 2018Shady Selim
 
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...Michael Rys
 

Similar a Dart language guide for developers (20)

Scala for Java Developers
Scala for Java DevelopersScala for Java Developers
Scala for Java Developers
 
Mockist vs. Classicists TDD
Mockist vs. Classicists TDDMockist vs. Classicists TDD
Mockist vs. Classicists TDD
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
JSLounge - TypeScript 소개
JSLounge - TypeScript 소개JSLounge - TypeScript 소개
JSLounge - TypeScript 소개
 
みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」
 
第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript
 
C# - What's Next?
C# - What's Next?C# - What's Next?
C# - What's Next?
 
Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2Android Development Course in HSE lecture #2
Android Development Course in HSE lecture #2
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: Kotlin
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
NLJUG University Sessie: Java Reborn, Powered by Ordina
NLJUG University Sessie: Java Reborn, Powered by OrdinaNLJUG University Sessie: Java Reborn, Powered by Ordina
NLJUG University Sessie: Java Reborn, Powered by Ordina
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David Szakallas
 
Module Ninja .JS
Module Ninja .JSModule Ninja .JS
Module Ninja .JS
 
Core2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfCore2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdf
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
 
Intro to kotlin 2018
Intro to kotlin 2018Intro to kotlin 2018
Intro to kotlin 2018
 
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
 
Clojure intro
Clojure introClojure intro
Clojure intro
 

Último

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Último (20)

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

Dart language guide for developers

  • 1. Dart Iván Zaera Avellón Co: izaera@gmail.com Tw: @izaera
  • 2. Table of contents ● Language features ● Testing – Data typing – Tests – Specific language constructions – Mocks – Modularity and visibility – Mixins – Arithmetic ● More resources Concurrency model – Async, Futures, Completers – Isolates Development tools – ● – Dart project's management – Libraries and APIs – Code example: cipher library
  • 5. Data typing ● Optional typing ● Dynamic keyword ● Implicit interfaces ● Implements and extends are interchangeable ● Is and is! operator ● Checked runtime mode
  • 6. Specific language constructions (1/2) ● Cascade .. operator ● Closures ● One line functions (=>) ● Optional arguments ● Named arguments
  • 7. Specific language constructions (2/2) ● Factory constructors ● Named constructors ● Initialization of fields with this. syntax ● Getters, setters, and final ● Const
  • 8. Modularity and visibility ● Libraries and parts ● Visibility – Public – Library private ● Concise private modifier: _ ● Cannot extend library private classes
  • 9. Mixins ● Orthogonal functionality ● Used where OO is-a relation does not apply ● Keyword: with ● Only static mixins, not runtime (like Groovy's metaClass, for instance)
  • 10. Arithmetic ● Base num type with double and int subtypes ● All nums are signed ● ● ● Integers have infinite precision (VM handles two internal subtypes for efficiency) Doubles are stored in IEEE format Integers are implemented as doubles when compiled to Javascript :-(
  • 12. Async, Futures, Completers ● Async execution due to event loop (like JS) ● Futures – – ● Promise to provide a result of some computation some time in the future Difficult and cumbersome error handling Completers – Low level construction to signal Future finalization – Should be used with care because makes error handling more difficult than Futures
  • 13. Isolates ● Alternative to threads ● Message passing paradigm – Shared memory not allowed – Use SendPort for sending messages ● Less error prone ● But less efficient
  • 15. Tests ● DSL: group(), test(), expect() ● Matchers similar to Hamcrest Java library void main() { group( “converters:”, () { test( "toUint32()", () { expect( toUint32( 0x100000000 ), 0x00000000 ); expect( toUint32( -1 ), 0xFFFFFFFF ); }); }); }
  • 16. Mocks ● Mock by extending Mock class class MockObjectory extends Mock implements Objectory {} test( "getById() llama a Objectory.findOne() con la query correcta", () { final id = "test_object_id"; final db = new MockObjectory(); final mockEntity = new MockEntity(); db.when( callsTo("findOne",anything) ).alwaysReturn( new Future.value(mockEntity) ); final dao = new TestObjectoryDao( "collection", db ); return dao.getById(id).then( (entity) { var query = db.getLogs( callsTo("findOne", anything ) ).first.args[0].toString(); expect( query, equals("ObjectoryQueryBuilder(collection {_id: ObjectId(${id})})") ); }); });
  • 18. Development tools ● Dart editor – – Static analyzer – ● Lightweight Refactor tools Dart Javascript compiler – – ● Tree shaking Minifying Pub for dependency handling
  • 19. Dart project's management ● Two mailing lists: – – ● misc@dartlang.org : for common questions web@dartlang.org : for client side framework (Polymer) questions Bugtracking – ● http://dartbug.com : redirects to Google Code Version control system – – ● http://github.com/... Latest commits: https://code.google.com/p/dart/source/list Standardization – ECMA is working on Dart's standard – http://www.ecma-international.org/memento/TC52.htm
  • 20. Libraries and APIs (1/2) ● dart:async ● dart:chrome (client) ● dart:collection ● dart:core ● dart:html (client) ● dart:indexed_db (client) ● dart:io (server) ● dart:isolate ● dart:json ● dart:math ● dart:mirrors ● dart:svg (server) ● dart:typed_data ● dart:utf ● dart:web_audio (client) ● dart:web_gl (client) ● dart:web_sql (client)
  • 21. Libraries and APIs (2/2) ● args: a library to handle command line arguments ● crypto: a library with hash algorithms ● fixnum: fixed size ints (32 and 64 bits) ● intl: I18N support ● logging: standard logging ● meta: meta annotations library (for example: @deprecated y @override). ● serialization: object serialization support ● unittest: unit testing library ● mock: mocking library for unit testing (similar to mockito) ● matchers: matchers library for unit testing (similar to Hamcrest)
  • 22. Code example: cipher library ● Cryptography library ● Code based on Bouncy Castle java library ● https://github.com/izaera/cipher