265 lines
8.5 KiB
HTML
265 lines
8.5 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>Vigiglobe - compojure-api</title>
|
||
<meta name="description" content="Compojure API presentation">
|
||
<meta name="author" content="co-authored by Guillaume Buisson and Yann Esposito" />
|
||
<meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0, user-scalable=yes" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||
|
||
<link href="css/base.css" rel="stylesheet" type="text/css" />
|
||
<link href="css/solarized.css" rel="stylesheet" type="text/css" />
|
||
|
||
<script src="js/jquery-1.11.1.min.js"></script>
|
||
<script src="js/jmpress.min.js"></script>
|
||
<script src="js/highlight/highlight.pack.js"></script>
|
||
</head>
|
||
<body>
|
||
|
||
<div id="simple">
|
||
<article id="title" class="step basic">
|
||
<h1>compojure-api</h1>
|
||
<h2>Swagger & Schema FTW!</h2>
|
||
<author>
|
||
Guillaume Buisson & Yann Esposito
|
||
<br/>
|
||
<a href="http://vigiglobe.com" target="_blank">Vigiglobe</a>
|
||
</author>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>API?</h1>
|
||
<ul><li>Documentation?
|
||
</li><li>Fast?
|
||
</li><li>Libraries?
|
||
</li></ul>
|
||
</article>
|
||
<article class="step basic">
|
||
<div style="background-image: url('img/fonctionnel.jpg')" class="background cleartext">
|
||
<p>Language Fonctionnel</p>
|
||
<br/>
|
||
<p>Déclaratif <i class="hi">vs Impératif</i></p>
|
||
</div>
|
||
</article>
|
||
<article class="step basic">
|
||
<div style="background-image: url('img/pure.jpg')" class="background darktext">
|
||
<p>Pur</p>
|
||
<p><i class="hi right">vs disfonctionnel</i></p>
|
||
</div>
|
||
</article>
|
||
<article class="step basic">
|
||
<div style="background-image: url('img/lazy.jpg')" class="background">
|
||
<p>Fainéant</p>
|
||
<br/>
|
||
<br/>
|
||
<br/>
|
||
<p class="right">⇒ Structures infinies !!!</p>
|
||
</div>
|
||
</article>
|
||
<article class="step basic">
|
||
<div style="background-image: url('img/static-type.jpg')" class="background darktext">
|
||
<p>Système de Typage Moderne</p>
|
||
<br/>
|
||
<br/>
|
||
<br/>
|
||
<p class="right">⇒ Agréable & Utile !</p>
|
||
</div>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Propriétés <span class="hi">par défaut</span></h1>
|
||
<ul><li>Fonctionnel par défaut
|
||
</li><li>Pur par défaut
|
||
</li><li>Fainéant par défaut
|
||
</li><li>Système de typage hors du commun
|
||
</li></ul>
|
||
<span class="hi"><em>Encourage les bons choix par défaut</em></span>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Utilisation</h1>
|
||
<ul><li>Protège contre la distraction
|
||
</li><li>Protège contre sa bêtise
|
||
</li><li>Force les meilleurs usages
|
||
</li><li>Diminue le nombre de tests nécessaires
|
||
</li></ul>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Production ?</h1>
|
||
<ul><li>OUI (<a href="http://cufp.org">CUFP</a>)
|
||
</li><li>Très peu de bugs (finance, web, ...)
|
||
</li><li>De nombreuses bibliothèques (<a href="http://hackage.haskell.org">hackage</a>)
|
||
</li><li>Adaptabilité du code phénoménale
|
||
</li></ul>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Vitesse</h1>
|
||
<ul><li>C : ~ ½×
|
||
</li><li>Java : ~ 1×
|
||
</li><li>Dart : ~ 5×
|
||
</li><li>Python : ~ 12×
|
||
</li><li>Ruby : ~ 13×
|
||
</li><li>PHP : ~ 28×
|
||
</li></ul>
|
||
<a href="http://benchmarksgame.alioth.debian.org" target="_blank">source CLBG</a>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>Workflows (basic)</h1>
|
||
<ol style="line-height: 1.5em"><li>Programmer
|
||
</li><li>tester en cliquant/scrollant, REPL, etc...
|
||
</li><li>90% → détecter une erreur ⇒ <span class="hi">goto 1</span>
|
||
</li><li>envoyer en (recette/production)
|
||
</li><li>50% (10% si recette) → Erreur en production ⇒ <span class="hi">ARGH!!! goto 1</span>
|
||
</li></ol>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Workflows (TDD)</h1>
|
||
<ol style="line-height: 1.5em"><li>Écrire des tests (voir workflow basic)
|
||
</li><li>Programmer
|
||
</li><li>lancer les tests (66% erreur ⇒ <span class="hi">goto 2 ou 1</span>)
|
||
</li><li>tester en cliquant/scrollant, REPL, etc...
|
||
</li><li>30% détecter une erreur ⇒ <span class="hi">goto 1</span>
|
||
</li><li>envoyer en (recette/production)
|
||
</li><li>5 à 10%: Erreur en production ⇒ <span class="hi">ARGH !!! goto 1</span>
|
||
</li></ol>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Workflows Haskell (Type DD)</h1>
|
||
<ol style="line-height: 1.5em"><li>Programmer
|
||
</li><li>Compiler (90% erreur, corriger avec l'<span class="hi2">aide</span> <span class="hi">goto 1</span>)
|
||
</li><li>tester en cliquant/scrollant, REPL, etc...
|
||
</li><li>3% → détecter une erreur ⇒ <span class="hi">goto 1</span>
|
||
</li><li>envoyer en (recette/production)
|
||
</li><li>0.5% → Erreur en production ⇒ <span class="hi">ARGH !!! goto 1</span>
|
||
</li></ol>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>0,5% c'est encore trop!</h1>
|
||
<p>
|
||
<code>QuickCheck</code>, <code>SmallCheck</code>:<br/>
|
||
engendrent des tests unitaires aléatoirement
|
||
<br/>
|
||
<code>HUnit</code>:<br/>
|
||
Tests unitaires
|
||
</p>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Facile ?</h1>
|
||
<ul><li>Pas vraiment
|
||
</li><li>Nécessite un réel investissement
|
||
</li><li>Aide à la conception
|
||
</li></ul>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>Exemples (1)</h1>
|
||
<pre class="haskell">[1,2,3] == [1..3]
|
||
[1,2,3] == [1,2] ++ [3]
|
||
[1,2,3] == 1:2:[]
|
||
[1,3..10] == [1,3,5,7,9]
|
||
[1,3..10] !! 3 == 7
|
||
[1,'a',3] <span class="hi">✗</span>
|
||
[(1,'a'),(3,'c')] <span class="hi2">✓</span>
|
||
</pre>
|
||
</article>
|
||
<article class="step basic">
|
||
<h1>Exemples (2)</h1>
|
||
<pre class="haskell">fib = 0:1:zipWith (+) fib (tail fib)
|
||
|
||
take 15 fib ⇔
|
||
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]
|
||
|
||
fib !! 200 ⇔
|
||
280571172992510140037611932413038677189525
|
||
</pre>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>Exemples (3)</h1>
|
||
<pre class="haskell">sort [] = []
|
||
sort (x:xs) = sort [y | y <- xs, y < x] ++
|
||
[x] ++
|
||
sort [y | y <- xs, y >= x]
|
||
</pre>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>Exemples (3bis)</h1>
|
||
<pre class="haskell">sort [] = []
|
||
sort (x:xs) = sort (filter (< x) xs) ++
|
||
[x] ++
|
||
sort (filter (>= x) xs)
|
||
</pre>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>Le bon choix par défaut</h1>
|
||
<pre class="haskell" style="font-size: .5em">
|
||
data Metres a = Metres a
|
||
data Pieds a = Pieds a
|
||
|
||
launchTheMissiles :: Metres Integer -> IO ()
|
||
launchTheMissiles n = do ...
|
||
|
||
launchTheMissile 100 <span class="hi">✗</span>
|
||
hauteur = Pieds 3000
|
||
launchTheMissile hauteur <span class="hi">✗</span>
|
||
launchTheMissile (pieds2Metres hauteur) <span class="hi2">✓</span></pre>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>IO DSL</h1>
|
||
<pre class="haskell">main = do
|
||
putStrLn "Quel est votre nom?"
|
||
nom <- readLine
|
||
putStrLn ("Bonjour " ++ nom)
|
||
</pre>
|
||
</article>
|
||
|
||
<article class="step basic">
|
||
<h1>Conclusion</h1>
|
||
<ul><li>Language très haut niveau
|
||
</li><li>Rapide
|
||
</li><li>Sûr / moins de tests nécessaires
|
||
</li><li>Le bon choix par défaut
|
||
</li><li>Ouvre l'esprit
|
||
</li></ul>
|
||
</article>
|
||
|
||
</div>
|
||
|
||
<div class="hint">
|
||
<p>Use arrow keys to navigate</p>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
$(function() {
|
||
var roffset=4000;
|
||
for (var i=0; i<100; i++) {
|
||
$.jmpress("template","basic-"+i, {
|
||
x: roffset*i,
|
||
scale: 1,
|
||
})
|
||
$.jmpress("template","big-"+i, {
|
||
x: roffset*i,
|
||
scale: 2,
|
||
rotate: {x: 90}
|
||
})
|
||
}
|
||
$(".step").attr("data-template",function(i){
|
||
if (i==3) {
|
||
return "big-"+i;
|
||
} else {
|
||
return "basic-"+i;
|
||
}
|
||
})
|
||
$('#simple').jmpress({viewPort: {height: 2000, width: 3000, minScale: 0.01, maxScale: 100}});
|
||
});
|
||
$(document).ready(function(){
|
||
hljs.initHighlighting();
|
||
});
|
||
</script>
|
||
|
||
<!-- IGNORE BELOW THIS LINE -->
|
||
|
||
</body>
|
||
</html>
|