SlideShare ist ein Scribd-Unternehmen logo
1 von 67
Downloaden Sie, um offline zu lesen
<codeware/>
how to present code
your slides are not your IDE
$> not your console either
here are five rules for
presenting code
rule 1:
$ use monospaced font
$
or
monospace
proportional
monospace
proportional
fixed or variable
fixed or variable
var power = function(base, exponent) {
var result = 1;
for (var count = 0; count < exponent; count++)
result *= base;
return result;
};
var power = function(base, exponent) {
var result = 1;
for (var count = 0; count < exponent; count++)
result *= base;
return result;
};
monospace
proportional
var power = function(base, exponent) {
var result = 1;
for (var count = 0; count < exponent; count++)
result *= base;
return result;
};
var power = function(base, exponent) {
var result = 1;
for (var count = 0; count < exponent; count++)
result *= base;
return result;
};
monospace
proportional
monospace
monospaced fonts
have better readability
when presenting code
proportional
monospace
proportional it is harder to follow code
with proportional fonts
monospaced fonts
have better readability
when presenting code
use monospaced fonts
for code readability
rule 2:
$ use big fonts
$
presenting for a big audience?
$ this is not your desktop monitor
$ font size should be bigger
$
I mean BIGGER
than your think
I really mean BIGGER

than your think
console.log(“even BIGGER where possible”)
console
.log(“use line breaks”)
<body>
<button onClick=“coolFunction()” autofocus>too small</button>
</body>
<body>
<button
onClick=“coolFunction()”
autofocus>
same but BIGGER
</button>
</body>
BIGGER is betterhow do you expect people in the back to read this?
rule 3:
$ smart syntax

highlighting
$
this is not your IDE
use syntax highlighting
only where needed
this is not your IDE
use syntax highlighting
only where needed
Presenting code on your slides
usually results in a wall of text.
Highlight only the

specific parts you want your
audience to focus on.
Presenting code on your slides
usually results in a wall of text.
Highlight only the

specific parts you want your
audience to focus on.
Presenting code on your slides
usually results in a wall of text.
Highlight only the

specific parts you want your
audience to focus on.
3 slides example - Ruby map function
1
2
3
names = ['rey', 'fin', 'poe']
names.map! {|name| name.capitalize }
puts names
3 slides example - Ruby map function
1
2
3
names = ['rey', 'fin', 'poe']
names.map! {|name| name.capitalize }
puts names
3 slides example - Ruby map function
1
2
3
names = ['rey', 'fin', 'poe']
names.map! {|name| name.capitalize }
puts names
# output
Rey
Fin
Poe
3 slides example - Ruby map function
1
2
3
rule 4:
$ using ellipsis…
$
import sys
from ortools.constraint_solver import pywrapcp
# By default, solve the 8x8 problem.
n = 8 if len(sys.argv) < 2 else int(sys.argv[1])
# Creates the solver.
solver = pywrapcp.Solver("n-queens")
# Creates the variables.
# The array index is the row, and the value is the column.
queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)]
# Creates the constraints.
# All columns must be different.
# (The "not on the same row" constraint is implicit from the array we're
# using to store our variables; since no two elements of an array
# can have the same index, there can be no queens with the same row.)
solver.Add(solver.AllDifferent(queens))
# No two queens can be on the same diagonal.
solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)]))
solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)]))
db = solver.Phase(queens,
solver.CHOOSE_MIN_SIZE_LOWEST_MAX,
solver.ASSIGN_CENTER_VALUE)
solver.NewSearch(db)
# Iterates through the solutions, displaying each.
num_solutions = 0
while solver.NextSolution():
queen_columns = [int(queens[i].Value()) for i in range(n)]
# Displays the solution just computed.
for i in range(n):
for j in range(n):
if queen_columns[i] == j:
print "Q",
else:
print "_",
print
print
num_solutions += 1
solver.EndSearch()
print
print "Solutions found:", num_solutions
print "Time:", solver.WallTime(), "ms"
Solving the N-queens Problem
import sys
from ortools.constraint_solver import pywrapcp
# By default, solve the 8x8 problem.
n = 8 if len(sys.argv) < 2 else int(sys.argv[1])
# Creates the solver.
solver = pywrapcp.Solver("n-queens")
# Creates the variables.
# The array index is the row, and the value is the column.
queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)]
# Creates the constraints.
# All columns must be different.
# (The "not on the same row" constraint is implicit from the array we're
# using to store our variables; since no two elements of an array
# can have the same index, there can be no queens with the same row.)
solver.Add(solver.AllDifferent(queens))
# No two queens can be on the same diagonal.
solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)]))
solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)]))
db = solver.Phase(queens,
solver.CHOOSE_MIN_SIZE_LOWEST_MAX,
solver.ASSIGN_CENTER_VALUE)
solver.NewSearch(db)
# Iterates through the solutions, displaying each.
num_solutions = 0
while solver.NextSolution():
queen_columns = [int(queens[i].Value()) for i in range(n)]
# Displays the solution just computed.
for i in range(n):
for j in range(n):
if queen_columns[i] == j:
print "Q",
else:
print "_",
print
print
num_solutions += 1
solver.EndSearch()
print
print "Solutions found:", num_solutions
print "Time:", solver.WallTime(), "ms"
Solving the N-queens Problem
what’s the point in presenting all you code if
people can’t follow?
import sys
from ortools.constraint_solver import pywrapcp
# By default, solve the 8x8 problem.
n = 8 if len(sys.argv) < 2 else int(sys.argv[1])
# Creates the solver.
solver = pywrapcp.Solver("n-queens")
# Creates the variables.
# The array index is the row, and the value is the column.
queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)]
# Creates the constraints.
# All columns must be different.
# (The "not on the same row" constraint is implicit from the array we're
# using to store our variables; since no two elements of an array
# can have the same index, there can be no queens with the same row.)
solver.Add(solver.AllDifferent(queens))
# No two queens can be on the same diagonal.
solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)]))
solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)]))
db = solver.Phase(queens,
solver.CHOOSE_MIN_SIZE_LOWEST_MAX,
solver.ASSIGN_CENTER_VALUE)
solver.NewSearch(db)
# Iterates through the solutions, displaying each.
num_solutions = 0
while solver.NextSolution():
queen_columns = [int(queens[i].Value()) for i in range(n)]
# Displays the solution just computed.
for i in range(n):
for j in range(n):
if queen_columns[i] == j:
print "Q",
else:
print "_",
print
print
num_solutions += 1
solver.EndSearch()
print
print "Solutions found:", num_solutions
print "Time:", solver.WallTime(), "ms"
Solving the N-queens Problem
keep just the relevant code
import sys
from ortools.constraint_solver import pywrapcp
# By default, solve the 8x8 problem.
n = 8 if len(sys.argv) < 2 else int(sys.argv[1])
# Creates the solver.
solver = pywrapcp.Solver("n-queens")
# Creates the variables.
# The array index is the row, and the value is the column.
queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)]
# Creates the constraints.
# All columns must be different.
# (The "not on the same row" constraint is implicit from the array we're
# using to store our variables; since no two elements of an array
# can have the same index, there can be no queens with the same row.)
solver.Add(solver.AllDifferent(queens))
# No two queens can be on the same diagonal.
solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)]))
solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)]))
db = solver.Phase(queens,
solver.CHOOSE_MIN_SIZE_LOWEST_MAX,
solver.ASSIGN_CENTER_VALUE)
solver.NewSearch(db)
# Iterates through the solutions, displaying each.
num_solutions = 0
while solver.NextSolution():
queen_columns = [int(queens[i].Value()) for i in range(n)]
# Displays the solution just computed.
for i in range(n):
for j in range(n):
if queen_columns[i] == j:
print "Q",
else:
print "_",
print
print
num_solutions += 1
solver.EndSearch()
print
print "Solutions found:", num_solutions
print "Time:", solver.WallTime(), "ms"
Solving the N-queens Problem
use ellipsis…
...
# Creates the solver.
solver = pywrapcp.Solver("n-queens")
...
# Iterates through the solutions, displaying each.
num_solutions = 0
while solver.NextSolution():
queen_columns = [int(queens[i].Value()) for i in range(n)]
# Displays the solution just computed.
for i in range(n):
for j in range(n):
if queen_columns[i] == j:
print "Q",
else:
print "_",
print
print
num_solutions += 1
solver.EndSearch()
...
Solving the N-queens Problem
...
# Creates the solver.
solver = pywrapcp.Solver("n-queens")
...
# Iterates through the solutions, displaying each.
num_solutions = 0
while solver.NextSolution():
queen_columns = [int(queens[i].Value()) for i in range(n)]
# Displays the solution just computed.
for i in range(n):
for j in range(n):
if queen_columns[i] == j:
print "Q",
else:
print "_",
print
print
num_solutions += 1
solver.EndSearch()
...
Solving the N-queens Problem
the focus is now on the algorithm

not the boilerplate
rule 5:
$ use screen annotation
$
do you want to focus your
audience’s attention on a
specific area in the screen?
thinking of using a laser
pointer?
do you expect your audience
to track this?
always create slides as if
you are the person sitting

in the last row of the
conference hall.
use screen annotations.
always create slides as if
you are the person sitting

in the last row of the
conference hall.
use screen annotations.
always create slides as if
you are the person sitting

in the last row of the
conference hall.
use screen annotations.
always create slides as if
you are the person sitting

in the last row of the
conference hall.
use screen annotations.
putting it all together
$ ECMAScript 2015 Promise example
$
putting it all together
$ ECMAScript 2015 Promise example
$
the next slides will introduce the

ECMAScript 2015 Promise Object
fetchGraphData(graphName, function(error, graphData)) {
if (error) { // handle error }
// ...
renderGraph(graphData, function(error)) {
if (error) { // handle error }
// ...
notifyClients(msg, result, function(error, response)) {
if (error) { // handle error }
// ...
});
});
});
Typical JS code results with

many nested callbacks
fetchGraphData(graphName, function(error, graphData)) {
if (error) { // handle error }
// ...
renderGraph(graphData, function(error)) {
if (error) { // handle error }
// ...
notifyClients(msg, result, function(error, response)) {
if (error) { // handle error }
// ...
});
});
});
makes it hard to follow
fetchGraphData(graphName, function(error, graphData)) {
if (error) { // handle error }
// ...
renderGraph(graphData, function(error)) {
if (error) { // handle error }
// ...
notifyClients(msg, result, function(error, response)) {
if (error) { // handle error }
// ...
});
});
});
error handling is duplicated
ECMAScript 2015 Promise
to the rescue!
function fetchGraphData(graphName) {
return new Promise(function(resolve, reject)) {
let request = new XMLHttpRequest();
...

// XMLHttpRequest to server
request.open(‘GET’, ‘http://example.com', true);
request.onload = function() {
if (request.status == 200) {
resolve(request.response);
}
else {
reject(new Error(request.status));
}
};
});
The Promise object is used for deferred and
asynchronous computations
function fetchGraphData(graphName) {
return new Promise(function(resolve, reject)) {
let request = new XMLHttpRequest();
...

// XMLHttpRequest to server
request.open(‘GET’, ‘http://example.com', true);
request.onload = function() {
if (request.status == 200) {
resolve(request.response);
}
else {
reject(new Error(request.status));
}
};
});
resolve is called once operation has completed
successfully
function fetchGraphData(graphName) {
return new Promise(function(resolve, reject)) {
let request = new XMLHttpRequest();
...

// XMLHttpRequest to server
request.open(‘GET’, ‘http://example.com', true);
request.onload = function() {
if (request.status == 200) {
resolve(request.response);
}
else {
reject(new Error(request.status));
}
};
});
reject is called if the operation has been
rejected
fetchGraphData(graphName)
.then(renderGraph)
.then(notifyClients)
.catch(function(error)) {
console.log(“Error:”, error)
});
Calling a Promise
Promise code is easy to read
fetchGraphData(graphName)
.then(renderGraph)
.then(notifyClients)
.catch(function(error)) {
console.log(“Error:”, error)
});
you can nest multiple Promise calls
Calling a Promise
fetchGraphData(graphName)
.then(renderGraph)
.then(notifyClients)
.catch(function(error)) {
console.log(“Error:”, error)
});
Calling a Promise
one error handling call
remember!

your slides are not your IDE
1
codeware - 5 rules
2 3
4 5
codeware - 5 rules
2 3
4 5
monospaced
font
codeware - 5 rules
3
4 5
monospaced
font BIG
codeware - 5 rules
4 5
monospaced
font BIG
smart syntax

highlighting
codeware - 5 rules
5
monospaced
font BIG
smart syntax
highlighting
ellipsis...
monospaced
font
codeware - 5 rules
BIG
smart syntax
highlighting
ellipsis...
screen
annotation
Credits
The Noun Project:
Check by useiconic.com
Close by Thomas Drach
N-queens problem:
OR-tools solution to the N-queens problem.
Inspired by Hakan Kjellerstrand's solution at
http://www.hakank.org/google_or_tools/,
which is licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
https://developers.google.com/optimization/puzzles/queens#python
for more tips

follow me on twitter and slideshare

Weitere ähnliche Inhalte

Was ist angesagt?

[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기Young-Ho Cho
 
Підсумковий урок по темі "Звичайні дроби"
Підсумковий урок по темі "Звичайні дроби"Підсумковий урок по темі "Звичайні дроби"
Підсумковий урок по темі "Звичайні дроби"sveta7940
 
외계어 스터디 1/5 - Overview
외계어 스터디 1/5 - Overview외계어 스터디 1/5 - Overview
외계어 스터디 1/5 - Overview민태 김
 
побудова правильних многокутників
побудова правильних многокутниківпобудова правильних многокутників
побудова правильних многокутниківelenatkachuk
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJSstefanmayer13
 
손코딩뇌컴파일눈디버깅을 소개합니다.
손코딩뇌컴파일눈디버깅을 소개합니다.손코딩뇌컴파일눈디버깅을 소개합니다.
손코딩뇌컴파일눈디버깅을 소개합니다.Kwangsung Ha
 
機器學習簡報 / 机器学习简报 Machine Learning
機器學習簡報 / 机器学习简报 Machine Learning 機器學習簡報 / 机器学习简报 Machine Learning
機器學習簡報 / 机器学习简报 Machine Learning Will Kuan 官大鈞
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Scott Wlaschin
 
Мішані числа.pptx
Мішані числа.pptxМішані числа.pptx
Мішані числа.pptxssuser57bbe9
 
Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)Scott Wlaschin
 
用十分鐘瞭解 Tensorflow.js (Google的JavaScript深度學習套件)
用十分鐘瞭解 Tensorflow.js   (Google的JavaScript深度學習套件)  用十分鐘瞭解 Tensorflow.js   (Google的JavaScript深度學習套件)
用十分鐘瞭解 Tensorflow.js (Google的JavaScript深度學習套件) 鍾誠 陳鍾誠
 
PhD defense presenation
PhD defense presenationPhD defense presenation
PhD defense presenationPooja Rani
 
二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ
二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ
二分探索法で作る再帰呼び出しできるCプリプロセッサマクロdigitalghost
 
競技プログラミングで便利な外部ツールを大量紹介
競技プログラミングで便利な外部ツールを大量紹介競技プログラミングで便利な外部ツールを大量紹介
競技プログラミングで便利な外部ツールを大量紹介xryuseix
 
презентація уроку 8 клас технологія критичного мислення
презентація уроку 8 клас технологія критичного мисленняпрезентація уроку 8 клас технологія критичного мислення
презентація уроку 8 клас технологія критичного мисленняanna1691
 
텐서플로우 2.0 튜토리얼 - RNN
텐서플로우 2.0 튜토리얼 - RNN텐서플로우 2.0 튜토리얼 - RNN
텐서플로우 2.0 튜토리얼 - RNNHwanhee Kim
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지Haesun Park
 

Was ist angesagt? (20)

[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기[PreSchool-1] 프로그래밍 '개념' 맛보기
[PreSchool-1] 프로그래밍 '개념' 맛보기
 
1
11
1
 
DDD 준비 서문래
DDD 준비 서문래DDD 준비 서문래
DDD 준비 서문래
 
Підсумковий урок по темі "Звичайні дроби"
Підсумковий урок по темі "Звичайні дроби"Підсумковий урок по темі "Звичайні дроби"
Підсумковий урок по темі "Звичайні дроби"
 
외계어 스터디 1/5 - Overview
외계어 스터디 1/5 - Overview외계어 스터디 1/5 - Overview
외계어 스터디 1/5 - Overview
 
побудова правильних многокутників
побудова правильних многокутниківпобудова правильних многокутників
побудова правильних многокутників
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
손코딩뇌컴파일눈디버깅을 소개합니다.
손코딩뇌컴파일눈디버깅을 소개합니다.손코딩뇌컴파일눈디버깅을 소개합니다.
손코딩뇌컴파일눈디버깅을 소개합니다.
 
機器學習簡報 / 机器学习简报 Machine Learning
機器學習簡報 / 机器学习简报 Machine Learning 機器學習簡報 / 机器学习简报 Machine Learning
機器學習簡報 / 机器学习简报 Machine Learning
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
 
Мішані числа.pptx
Мішані числа.pptxМішані числа.pptx
Мішані числа.pptx
 
Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)
 
用十分鐘瞭解 Tensorflow.js (Google的JavaScript深度學習套件)
用十分鐘瞭解 Tensorflow.js   (Google的JavaScript深度學習套件)  用十分鐘瞭解 Tensorflow.js   (Google的JavaScript深度學習套件)
用十分鐘瞭解 Tensorflow.js (Google的JavaScript深度學習套件)
 
PhD defense presenation
PhD defense presenationPhD defense presenation
PhD defense presenation
 
二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ
二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ
二分探索法で作る再帰呼び出しできるCプリプロセッサマクロ
 
競技プログラミングで便利な外部ツールを大量紹介
競技プログラミングで便利な外部ツールを大量紹介競技プログラミングで便利な外部ツールを大量紹介
競技プログラミングで便利な外部ツールを大量紹介
 
直交領域探索
直交領域探索直交領域探索
直交領域探索
 
презентація уроку 8 клас технологія критичного мислення
презентація уроку 8 клас технологія критичного мисленняпрезентація уроку 8 клас технологія критичного мислення
презентація уроку 8 клас технологія критичного мислення
 
텐서플로우 2.0 튜토리얼 - RNN
텐서플로우 2.0 튜토리얼 - RNN텐서플로우 2.0 튜토리얼 - RNN
텐서플로우 2.0 튜토리얼 - RNN
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
 

Ähnlich wie Codeware

Coffee script
Coffee scriptCoffee script
Coffee scripttimourian
 
N Queen Problem using Branch And Bound - GeeksforGeeks.pdf
N Queen Problem using Branch And Bound - GeeksforGeeks.pdfN Queen Problem using Branch And Bound - GeeksforGeeks.pdf
N Queen Problem using Branch And Bound - GeeksforGeeks.pdfakashreddy966699
 
Itroroduction to R language
Itroroduction to R languageItroroduction to R language
Itroroduction to R languagechhabria-nitesh
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with GroovyArturo Herrero
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptximman gwu
 
Ruby from zero to hero
Ruby from zero to heroRuby from zero to hero
Ruby from zero to heroDiego Lemos
 
Ruby data types and objects
Ruby   data types and objectsRuby   data types and objects
Ruby data types and objectsHarkamal Singh
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With ScalaKnoldus Inc.
 
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
 
A limited guide to intermediate and advanced Ruby
A limited guide to intermediate and advanced RubyA limited guide to intermediate and advanced Ruby
A limited guide to intermediate and advanced RubyVysakh Sreenivasan
 
Introducing Pattern Matching in Scala
 Introducing Pattern Matching  in Scala Introducing Pattern Matching  in Scala
Introducing Pattern Matching in ScalaAyush Mishra
 
lpSolve - R Library
lpSolve - R LibrarylpSolve - R Library
lpSolve - R LibraryDavid Faris
 

Ähnlich wie Codeware (20)

Coffee script
Coffee scriptCoffee script
Coffee script
 
N Queen Problem using Branch And Bound - GeeksforGeeks.pdf
N Queen Problem using Branch And Bound - GeeksforGeeks.pdfN Queen Problem using Branch And Bound - GeeksforGeeks.pdf
N Queen Problem using Branch And Bound - GeeksforGeeks.pdf
 
Itroroduction to R language
Itroroduction to R languageItroroduction to R language
Itroroduction to R language
 
Ruby Basics
Ruby BasicsRuby Basics
Ruby Basics
 
18 ruby ranges
18 ruby ranges18 ruby ranges
18 ruby ranges
 
Tutorial 2
Tutorial     2Tutorial     2
Tutorial 2
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
 
06 ruby variables
06 ruby variables06 ruby variables
06 ruby variables
 
Ruby from zero to hero
Ruby from zero to heroRuby from zero to hero
Ruby from zero to hero
 
Ruby data types and objects
Ruby   data types and objectsRuby   data types and objects
Ruby data types and objects
 
Functional Programming With Scala
Functional Programming With ScalaFunctional Programming With Scala
Functional Programming With Scala
 
cluster(python)
cluster(python)cluster(python)
cluster(python)
 
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
 
A limited guide to intermediate and advanced Ruby
A limited guide to intermediate and advanced RubyA limited guide to intermediate and advanced Ruby
A limited guide to intermediate and advanced Ruby
 
Matlab algebra
Matlab algebraMatlab algebra
Matlab algebra
 
Ruby Intro {spection}
Ruby Intro {spection}Ruby Intro {spection}
Ruby Intro {spection}
 
Introducing Pattern Matching in Scala
 Introducing Pattern Matching  in Scala Introducing Pattern Matching  in Scala
Introducing Pattern Matching in Scala
 
lpSolve - R Library
lpSolve - R LibrarylpSolve - R Library
lpSolve - R Library
 
Clojure for Rubyists
Clojure for RubyistsClojure for Rubyists
Clojure for Rubyists
 

Kürzlich hochgeladen

Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 

Kürzlich hochgeladen (20)

Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 

Codeware

  • 2. your slides are not your IDE
  • 3. $> not your console either
  • 4. here are five rules for presenting code
  • 5. rule 1: $ use monospaced font $
  • 8. var power = function(base, exponent) { var result = 1; for (var count = 0; count < exponent; count++) result *= base; return result; }; var power = function(base, exponent) { var result = 1; for (var count = 0; count < exponent; count++) result *= base; return result; }; monospace proportional
  • 9. var power = function(base, exponent) { var result = 1; for (var count = 0; count < exponent; count++) result *= base; return result; }; var power = function(base, exponent) { var result = 1; for (var count = 0; count < exponent; count++) result *= base; return result; }; monospace proportional
  • 10. monospace monospaced fonts have better readability when presenting code proportional
  • 11. monospace proportional it is harder to follow code with proportional fonts monospaced fonts have better readability when presenting code
  • 12. use monospaced fonts for code readability
  • 13. rule 2: $ use big fonts $
  • 14. presenting for a big audience? $ this is not your desktop monitor $ font size should be bigger $
  • 15. I mean BIGGER than your think
  • 16. I really mean BIGGER
 than your think
  • 21. BIGGER is betterhow do you expect people in the back to read this?
  • 22. rule 3: $ smart syntax
 highlighting $
  • 23. this is not your IDE use syntax highlighting only where needed
  • 24. this is not your IDE use syntax highlighting only where needed
  • 25. Presenting code on your slides usually results in a wall of text. Highlight only the
 specific parts you want your audience to focus on.
  • 26. Presenting code on your slides usually results in a wall of text. Highlight only the
 specific parts you want your audience to focus on.
  • 27. Presenting code on your slides usually results in a wall of text. Highlight only the
 specific parts you want your audience to focus on.
  • 28. 3 slides example - Ruby map function 1 2 3
  • 29. names = ['rey', 'fin', 'poe'] names.map! {|name| name.capitalize } puts names 3 slides example - Ruby map function 1 2 3
  • 30. names = ['rey', 'fin', 'poe'] names.map! {|name| name.capitalize } puts names 3 slides example - Ruby map function 1 2 3
  • 31. names = ['rey', 'fin', 'poe'] names.map! {|name| name.capitalize } puts names # output Rey Fin Poe 3 slides example - Ruby map function 1 2 3
  • 32. rule 4: $ using ellipsis… $
  • 33. import sys from ortools.constraint_solver import pywrapcp # By default, solve the 8x8 problem. n = 8 if len(sys.argv) < 2 else int(sys.argv[1]) # Creates the solver. solver = pywrapcp.Solver("n-queens") # Creates the variables. # The array index is the row, and the value is the column. queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)] # Creates the constraints. # All columns must be different. # (The "not on the same row" constraint is implicit from the array we're # using to store our variables; since no two elements of an array # can have the same index, there can be no queens with the same row.) solver.Add(solver.AllDifferent(queens)) # No two queens can be on the same diagonal. solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)])) solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)])) db = solver.Phase(queens, solver.CHOOSE_MIN_SIZE_LOWEST_MAX, solver.ASSIGN_CENTER_VALUE) solver.NewSearch(db) # Iterates through the solutions, displaying each. num_solutions = 0 while solver.NextSolution(): queen_columns = [int(queens[i].Value()) for i in range(n)] # Displays the solution just computed. for i in range(n): for j in range(n): if queen_columns[i] == j: print "Q", else: print "_", print print num_solutions += 1 solver.EndSearch() print print "Solutions found:", num_solutions print "Time:", solver.WallTime(), "ms" Solving the N-queens Problem
  • 34. import sys from ortools.constraint_solver import pywrapcp # By default, solve the 8x8 problem. n = 8 if len(sys.argv) < 2 else int(sys.argv[1]) # Creates the solver. solver = pywrapcp.Solver("n-queens") # Creates the variables. # The array index is the row, and the value is the column. queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)] # Creates the constraints. # All columns must be different. # (The "not on the same row" constraint is implicit from the array we're # using to store our variables; since no two elements of an array # can have the same index, there can be no queens with the same row.) solver.Add(solver.AllDifferent(queens)) # No two queens can be on the same diagonal. solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)])) solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)])) db = solver.Phase(queens, solver.CHOOSE_MIN_SIZE_LOWEST_MAX, solver.ASSIGN_CENTER_VALUE) solver.NewSearch(db) # Iterates through the solutions, displaying each. num_solutions = 0 while solver.NextSolution(): queen_columns = [int(queens[i].Value()) for i in range(n)] # Displays the solution just computed. for i in range(n): for j in range(n): if queen_columns[i] == j: print "Q", else: print "_", print print num_solutions += 1 solver.EndSearch() print print "Solutions found:", num_solutions print "Time:", solver.WallTime(), "ms" Solving the N-queens Problem what’s the point in presenting all you code if people can’t follow?
  • 35. import sys from ortools.constraint_solver import pywrapcp # By default, solve the 8x8 problem. n = 8 if len(sys.argv) < 2 else int(sys.argv[1]) # Creates the solver. solver = pywrapcp.Solver("n-queens") # Creates the variables. # The array index is the row, and the value is the column. queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)] # Creates the constraints. # All columns must be different. # (The "not on the same row" constraint is implicit from the array we're # using to store our variables; since no two elements of an array # can have the same index, there can be no queens with the same row.) solver.Add(solver.AllDifferent(queens)) # No two queens can be on the same diagonal. solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)])) solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)])) db = solver.Phase(queens, solver.CHOOSE_MIN_SIZE_LOWEST_MAX, solver.ASSIGN_CENTER_VALUE) solver.NewSearch(db) # Iterates through the solutions, displaying each. num_solutions = 0 while solver.NextSolution(): queen_columns = [int(queens[i].Value()) for i in range(n)] # Displays the solution just computed. for i in range(n): for j in range(n): if queen_columns[i] == j: print "Q", else: print "_", print print num_solutions += 1 solver.EndSearch() print print "Solutions found:", num_solutions print "Time:", solver.WallTime(), "ms" Solving the N-queens Problem keep just the relevant code
  • 36. import sys from ortools.constraint_solver import pywrapcp # By default, solve the 8x8 problem. n = 8 if len(sys.argv) < 2 else int(sys.argv[1]) # Creates the solver. solver = pywrapcp.Solver("n-queens") # Creates the variables. # The array index is the row, and the value is the column. queens = [solver.IntVar(0, n - 1, "x%i" % i) for i in range(n)] # Creates the constraints. # All columns must be different. # (The "not on the same row" constraint is implicit from the array we're # using to store our variables; since no two elements of an array # can have the same index, there can be no queens with the same row.) solver.Add(solver.AllDifferent(queens)) # No two queens can be on the same diagonal. solver.Add(solver.AllDifferent([queens[i] + i for i in range(n)])) solver.Add(solver.AllDifferent([queens[i] - i for i in range(n)])) db = solver.Phase(queens, solver.CHOOSE_MIN_SIZE_LOWEST_MAX, solver.ASSIGN_CENTER_VALUE) solver.NewSearch(db) # Iterates through the solutions, displaying each. num_solutions = 0 while solver.NextSolution(): queen_columns = [int(queens[i].Value()) for i in range(n)] # Displays the solution just computed. for i in range(n): for j in range(n): if queen_columns[i] == j: print "Q", else: print "_", print print num_solutions += 1 solver.EndSearch() print print "Solutions found:", num_solutions print "Time:", solver.WallTime(), "ms" Solving the N-queens Problem use ellipsis…
  • 37. ... # Creates the solver. solver = pywrapcp.Solver("n-queens") ... # Iterates through the solutions, displaying each. num_solutions = 0 while solver.NextSolution(): queen_columns = [int(queens[i].Value()) for i in range(n)] # Displays the solution just computed. for i in range(n): for j in range(n): if queen_columns[i] == j: print "Q", else: print "_", print print num_solutions += 1 solver.EndSearch() ... Solving the N-queens Problem
  • 38. ... # Creates the solver. solver = pywrapcp.Solver("n-queens") ... # Iterates through the solutions, displaying each. num_solutions = 0 while solver.NextSolution(): queen_columns = [int(queens[i].Value()) for i in range(n)] # Displays the solution just computed. for i in range(n): for j in range(n): if queen_columns[i] == j: print "Q", else: print "_", print print num_solutions += 1 solver.EndSearch() ... Solving the N-queens Problem the focus is now on the algorithm
 not the boilerplate
  • 39. rule 5: $ use screen annotation $
  • 40. do you want to focus your audience’s attention on a specific area in the screen?
  • 41. thinking of using a laser pointer?
  • 42. do you expect your audience to track this?
  • 43. always create slides as if you are the person sitting
 in the last row of the conference hall. use screen annotations.
  • 44. always create slides as if you are the person sitting
 in the last row of the conference hall. use screen annotations.
  • 45. always create slides as if you are the person sitting
 in the last row of the conference hall. use screen annotations.
  • 46. always create slides as if you are the person sitting
 in the last row of the conference hall. use screen annotations.
  • 47. putting it all together $ ECMAScript 2015 Promise example $
  • 48. putting it all together $ ECMAScript 2015 Promise example $ the next slides will introduce the
 ECMAScript 2015 Promise Object
  • 49. fetchGraphData(graphName, function(error, graphData)) { if (error) { // handle error } // ... renderGraph(graphData, function(error)) { if (error) { // handle error } // ... notifyClients(msg, result, function(error, response)) { if (error) { // handle error } // ... }); }); }); Typical JS code results with
 many nested callbacks
  • 50. fetchGraphData(graphName, function(error, graphData)) { if (error) { // handle error } // ... renderGraph(graphData, function(error)) { if (error) { // handle error } // ... notifyClients(msg, result, function(error, response)) { if (error) { // handle error } // ... }); }); }); makes it hard to follow
  • 51. fetchGraphData(graphName, function(error, graphData)) { if (error) { // handle error } // ... renderGraph(graphData, function(error)) { if (error) { // handle error } // ... notifyClients(msg, result, function(error, response)) { if (error) { // handle error } // ... }); }); }); error handling is duplicated
  • 53. function fetchGraphData(graphName) { return new Promise(function(resolve, reject)) { let request = new XMLHttpRequest(); ...
 // XMLHttpRequest to server request.open(‘GET’, ‘http://example.com', true); request.onload = function() { if (request.status == 200) { resolve(request.response); } else { reject(new Error(request.status)); } }; }); The Promise object is used for deferred and asynchronous computations
  • 54. function fetchGraphData(graphName) { return new Promise(function(resolve, reject)) { let request = new XMLHttpRequest(); ...
 // XMLHttpRequest to server request.open(‘GET’, ‘http://example.com', true); request.onload = function() { if (request.status == 200) { resolve(request.response); } else { reject(new Error(request.status)); } }; }); resolve is called once operation has completed successfully
  • 55. function fetchGraphData(graphName) { return new Promise(function(resolve, reject)) { let request = new XMLHttpRequest(); ...
 // XMLHttpRequest to server request.open(‘GET’, ‘http://example.com', true); request.onload = function() { if (request.status == 200) { resolve(request.response); } else { reject(new Error(request.status)); } }; }); reject is called if the operation has been rejected
  • 60. 1 codeware - 5 rules 2 3 4 5
  • 61. codeware - 5 rules 2 3 4 5 monospaced font
  • 62. codeware - 5 rules 3 4 5 monospaced font BIG
  • 63. codeware - 5 rules 4 5 monospaced font BIG smart syntax
 highlighting
  • 64. codeware - 5 rules 5 monospaced font BIG smart syntax highlighting ellipsis...
  • 65. monospaced font codeware - 5 rules BIG smart syntax highlighting ellipsis... screen annotation
  • 66. Credits The Noun Project: Check by useiconic.com Close by Thomas Drach N-queens problem: OR-tools solution to the N-queens problem. Inspired by Hakan Kjellerstrand's solution at http://www.hakank.org/google_or_tools/, which is licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 https://developers.google.com/optimization/puzzles/queens#python
  • 67. for more tips
 follow me on twitter and slideshare