root / JFP / slides.html

Revision 112:aa4492e1f366, 24.0 kB (checked in by Tarek Ziad?? <tarek@…>, 16 months ago)

fixed apis

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
7<meta name="version" content="S5 1.1" />
8<title>JPF'07</title>
9<style type="text/css">
10
11/*
12:Author: David Goodger
13:Contact: goodger@users.sourceforge.net
14:Date: $Date: 2005-12-18 01:56:14 +0100 (Sun, 18 Dec 2005) $
15:Revision: $Revision: 4224 $
16:Copyright: This stylesheet has been placed in the public domain.
17
18Default cascading style sheet for the HTML output of Docutils.
19
20See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
21customize this style sheet.
22*/
23
24/* used to remove borders from tables and images */
25.borderless, table.borderless td, table.borderless th {
26  border: 0 }
27
28table.borderless td, table.borderless th {
29  /* Override padding for "table.docutils td" with "! important".
30     The right padding separates the table cells. */
31  padding: 0 0.5em 0 0 ! important }
32
33.first {
34  /* Override more specific margin styles with "! important". */
35  margin-top: 0 ! important }
36
37.last, .with-subtitle {
38  margin-bottom: 0 ! important }
39
40.hidden {
41  display: none }
42
43a.toc-backref {
44  text-decoration: none ;
45  color: black }
46
47blockquote.epigraph {
48  margin: 2em 5em ; }
49
50dl.docutils dd {
51  margin-bottom: 0.5em }
52
53/* Uncomment (and remove this text!) to get bold-faced definition list terms
54dl.docutils dt {
55  font-weight: bold }
56*/
57
58div.abstract {
59  margin: 2em 5em }
60
61div.abstract p.topic-title {
62  font-weight: bold ;
63  text-align: center }
64
65div.admonition, div.attention, div.caution, div.danger, div.error,
66div.hint, div.important, div.note, div.tip, div.warning {
67  margin: 2em ;
68  border: medium outset ;
69  padding: 1em }
70
71div.admonition p.admonition-title, div.hint p.admonition-title,
72div.important p.admonition-title, div.note p.admonition-title,
73div.tip p.admonition-title {
74  font-weight: bold ;
75  font-family: sans-serif }
76
77div.attention p.admonition-title, div.caution p.admonition-title,
78div.danger p.admonition-title, div.error p.admonition-title,
79div.warning p.admonition-title {
80  color: red ;
81  font-weight: bold ;
82  font-family: sans-serif }
83
84/* Uncomment (and remove this text!) to get reduced vertical space in
85   compound paragraphs.
86div.compound .compound-first, div.compound .compound-middle {
87  margin-bottom: 0.5em }
88
89div.compound .compound-last, div.compound .compound-middle {
90  margin-top: 0.5em }
91*/
92
93div.dedication {
94  margin: 2em 5em ;
95  text-align: center ;
96  font-style: italic }
97
98div.dedication p.topic-title {
99  font-weight: bold ;
100  font-style: normal }
101
102div.figure {
103  margin-left: 2em ;
104  margin-right: 2em }
105
106div.footer, div.header {
107  clear: both;
108  font-size: smaller }
109
110div.line-block {
111  display: block ;
112  margin-top: 1em ;
113  margin-bottom: 1em }
114
115div.line-block div.line-block {
116  margin-top: 0 ;
117  margin-bottom: 0 ;
118  margin-left: 1.5em }
119
120div.sidebar {
121  margin-left: 1em ;
122  border: medium outset ;
123  padding: 1em ;
124  background-color: #ffffee ;
125  width: 40% ;
126  float: right ;
127  clear: right }
128
129div.sidebar p.rubric {
130  font-family: sans-serif ;
131  font-size: medium }
132
133div.system-messages {
134  margin: 5em }
135
136div.system-messages h1 {
137  color: red }
138
139div.system-message {
140  border: medium outset ;
141  padding: 1em }
142
143div.system-message p.system-message-title {
144  color: red ;
145  font-weight: bold }
146
147div.topic {
148  margin: 2em }
149
150h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
151h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
152  margin-top: 0.4em }
153
154h1.title {
155  text-align: center }
156
157h2.subtitle {
158  text-align: center }
159
160hr.docutils {
161  width: 75% }
162
163img.align-left {
164  clear: left }
165
166img.align-right {
167  clear: right }
168
169ol.simple, ul.simple {
170  margin-bottom: 1em }
171
172ol.arabic {
173  list-style: decimal }
174
175ol.loweralpha {
176  list-style: lower-alpha }
177
178ol.upperalpha {
179  list-style: upper-alpha }
180
181ol.lowerroman {
182  list-style: lower-roman }
183
184ol.upperroman {
185  list-style: upper-roman }
186
187p.attribution {
188  text-align: right ;
189  margin-left: 50% }
190
191p.caption {
192  font-style: italic }
193
194p.credits {
195  font-style: italic ;
196  font-size: smaller }
197
198p.label {
199  white-space: nowrap }
200
201p.rubric {
202  font-weight: bold ;
203  font-size: larger ;
204  color: maroon ;
205  text-align: center }
206
207p.sidebar-title {
208  font-family: sans-serif ;
209  font-weight: bold ;
210  font-size: larger }
211
212p.sidebar-subtitle {
213  font-family: sans-serif ;
214  font-weight: bold }
215
216p.topic-title {
217  font-weight: bold }
218
219pre.address {
220  margin-bottom: 0 ;
221  margin-top: 0 ;
222  font-family: serif ;
223  font-size: 100% }
224
225pre.literal-block, pre.doctest-block {
226  margin-left: 2em ;
227  margin-right: 2em ;
228  background-color: #eeeeee }
229
230span.classifier {
231  font-family: sans-serif ;
232  font-style: oblique }
233
234span.classifier-delimiter {
235  font-family: sans-serif ;
236  font-weight: bold }
237
238span.interpreted {
239  font-family: sans-serif }
240
241span.option {
242  white-space: nowrap }
243
244span.pre {
245  white-space: pre }
246
247span.problematic {
248  color: red }
249
250span.section-subtitle {
251  /* font-size relative to parent (h1..h6 element) */
252  font-size: 80% }
253
254table.citation {
255  border-left: solid 1px gray;
256  margin-left: 1px }
257
258table.docinfo {
259  margin: 2em 4em }
260
261table.docutils {
262  margin-top: 0.5em ;
263  margin-bottom: 0.5em }
264
265table.footnote {
266  border-left: solid 1px black;
267  margin-left: 1px }
268
269table.docutils td, table.docutils th,
270table.docinfo td, table.docinfo th {
271  padding-left: 0.5em ;
272  padding-right: 0.5em ;
273  vertical-align: top }
274
275table.docutils th.field-name, table.docinfo th.docinfo-name {
276  font-weight: bold ;
277  text-align: left ;
278  white-space: nowrap ;
279  padding-left: 0 }
280
281h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
282h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
283  font-size: 100% }
284
285tt.docutils {
286  background-color: #eeeeee }
287
288ul.auto-toc {
289  list-style-type: none }
290
291</style>
292<!-- configuration parameters -->
293<meta name="defaultView" content="slideshow" />
294<meta name="controlVis" content="hidden" />
295<!-- style sheet links -->
296<script src="ui/default/slides.js" type="text/javascript"></script>
297<link rel="stylesheet" href="ui/default/slides.css"
298      type="text/css" media="projection" id="slideProj" />
299<link rel="stylesheet" href="ui/default/outline.css"
300      type="text/css" media="screen" id="outlineStyle" />
301<link rel="stylesheet" href="ui/default/print.css"
302      type="text/css" media="print" id="slidePrint" />
303<link rel="stylesheet" href="ui/default/opera.css"
304      type="text/css" media="projection" id="operaFix" />
305
306<style type="text/css">
307#currentSlide {display: none;}
308</style>
309</head>
310<body>
311<div class="layout">
312<div id="controls"></div>
313<div id="currentSlide"></div>
314<div id="header">
315
316</div>
317<div id="footer">
318<h1>JPF'07</h1>
319
320</div>
321</div>
322<div class="presentation">
323<div class="slide" id="slide0">
324<h1 class="title">JPF'07</h1>
325<p>Le Document-Driven Developpement (DDD)</p>
326<table class="docutils field-list" frame="void" rules="none">
327<col class="field-name" />
328<col class="field-body" />
329<tbody valign="top">
330<tr class="field"><th class="field-name">Author:</th><td class="field-body">Tarek Ziadé &lt;<a class="reference" href="mailto:tarek&#64;ziade.org">tarek&#64;ziade.org</a>&gt;</td>
331</tr>
332<tr class="field"><th class="field-name">Date:</th><td class="field-body">$Date: 2007-02-21$</td>
333</tr>
334<tr class="field"><th class="field-name">License:</th><td class="field-body">CC-By-SA 2 license</td>
335</tr>
336</tbody>
337</table>
338<!-- contents: -->
339
340</div>
341<div class="slide" id="qui-suis-je">
342<h1>Qui suis-je ?</h1>
343<ul class="simple">
344<li>Développeur Python depuis 2000</li>
345<li>Auteur d'articles et de livres sur Python</li>
346<li>Président de l'AFPY</li>
347<li>Passionné par les méthodologies <strong>agiles</strong></li>
348</ul>
349</div>
350<div class="slide" id="pourquoi-cette-pr-sentation">
351<h1>Pourquoi cette présentation?</h1>
352<p>Objectifs:</p>
353<ul class="simple">
354<li>Sensibiliser les développeurs aux tests</li>
355<li>Expliquer comment les tests fonctionnent en Python</li>
356<li>Sensibiliser les développeurs au <strong>DDD</strong></li>
357<li>Expliquer pourquoi les <strong>doctests</strong> c'est merveilleux</li>
358</ul>
359<p><img alt="important" src="media/important.png" /> En un mot: comment développer <cite>agile</cite> en Python</p>
360</div>
361<div class="slide" id="id1">
362<h1>Pourquoi cette présentation?</h1>
363<p>Objectifs secrets (ne pas montrer ce slide):</p>
364<ul class="simple">
365<li>Ridiculiser Java</li>
366<li>Déprimer les développeurs Ruby</li>
367<li>Rendre les chefs de projet C# jaloux</li>
368<li>Augmenter le nombre d'adhérents à l'association</li>
369</ul>
370</div>
371<div class="slide" id="le-plan">
372<h1>Le plan</h1>
373<ul class="simple">
374<li><strong>Quelques définitions</strong> <img alt="smile" src="media/smile.png" /></li>
375<li><cite>Partie 1: le TDD avec Python</cite></li>
376<li><cite>Part 2: les doctests</cite></li>
377<li><cite>Part 3: le DDD</cite></li>
378</ul>
379</div>
380<div class="slide" id="quelques-d-finitions">
381<h1>Quelques définitions</h1>
382<p>Que veux dire le mot <strong>agile</strong> ?</p>
383</div>
384<div class="slide" id="id2">
385<h1>Quelques définitions</h1>
386<p>Tentative de définition appliqué au développement:</p>
387<p><strong>C'est une méthodologie de programmation qui permet de
388rester réactif aux fréquentes modifications d'une base
389de code</strong></p>
390<p>Viens de l'<cite>Agile Manifesto</cite> (<a class="reference" href="http://agilemanifesto.org/">http://agilemanifesto.org/</a> <a class="footnote-reference" href="#id4" id="id3" name="id3">[1]</a>)</p>
391<ul class="simple">
392<li>créé par le GoF (Beck, etc.) et co</li>
393<li>XP est une méthode agile populaire</li>
394</ul>
395<table class="docutils footnote" frame="void" id="id4" rules="none">
396<colgroup><col class="label" /><col /></colgroup>
397<tbody valign="top">
398<tr><td class="label"><a class="fn-backref" href="#id3" name="id4">[1]</a></td><td>Le site ressemble à celui d'une secte, mais c'est une bonne secte <img alt="wink" src="media/wink.png" /></td></tr>
399</tbody>
400</table>
401</div>
402<div class="slide" id="id5">
403<h1>Quelques définitions</h1>
404<p>Les principes agiles peuvent s'appliquer à tout processus répétitif:</p>
405<ul class="simple">
406<li>coder (-&gt; TDD)</li>
407<li>faire de la documentation (-&gt; DDD)</li>
408<li>passer la tondeuse</li>
409<li>etc.</li>
410</ul>
411</div>
412<div class="slide" id="id6">
413<h1>Quelques définitions</h1>
414<p>TDD == Test-Driven Development == Développement Dirigé par les Tests</p>
415</div>
416<div class="slide" id="id7">
417<h1>Le plan</h1>
418<ul class="simple">
419<li><cite>Quelques définitions</cite></li>
420<li><strong>Partie 1: le TDD avec Python</strong> <img alt="smile" src="media/smile.png" /></li>
421<li><cite>Part 2: les doctests</cite></li>
422<li><cite>Part 3: le DDD</cite></li>
423</ul>
424</div>
425<div class="slide" id="partie-1">
426<h1>Partie 1</h1>
427<p><strong>Le TDD avec Python</strong></p>
428<ul class="simple">
429<li><strong>Les principes du TDD</strong></li>
430<li><cite>Comment écrire des tests</cite></li>
431</ul>
432</div>
433<div class="slide" id="les-principes-du-tdd">
434<h1>Les principes du TDD</h1>
435<ul class="simple">
436<li>Chaque fonction == un ou plusieurs cas d'utilisation</li>
437<li>Un cas d'utilisation == un test possible</li>
438</ul>
439</div>
440<div class="slide" id="id8">
441<h1>Les principes du TDD</h1>
442<p>Exemple:</p>
443<pre class="literal-block">
444&gt;&gt;&gt; def division(a, b):
445...     return a / b
446</pre>
447<p>Essayons !</p>
448<pre class="literal-block">
449&gt;&gt;&gt; def test_division():
450...     if division(4, 2) == 2:
451...         return 'OK'
452...     else:
453...         return 'Le processeur est moisi'
454&gt;&gt;&gt; test_division()
455'OK'
456</pre>
457</div>
458<div class="slide" id="id9">
459<h1>Les principes du TDD</h1>
460<p>Chaque test concerne un aspect du code.</p>
461<p>En voici un autre:</p>
462<pre class="literal-block">
463&gt;&gt;&gt; def test_division2():
464...     if division(4, 0) == 0:
465...         return 'OK'
466...     else:
467...         return &quot;C'est discutable...&quot;
468&gt;&gt;&gt; test_division2()
469Traceback (most recent call last):
470...
471ZeroDivisionError: integer division or modulo by zero
472</pre>
473</div>
474<div class="slide" id="id10">
475<h1>Les principes du TDD</h1>
476<p>Ca plante, changeons la fonction:</p>
477<pre class="literal-block">
478&gt;&gt;&gt; def division(a, b):
479...     if b == 0:
480...         return 0
481...     return a / b
482</pre>
483<p>relancons le test:</p>
484<pre class="literal-block">
485&gt;&gt;&gt; test_division2()
486'OK'
487</pre>
488</div>
489<div class="slide" id="id11">
490<h1>Les principes du TDD</h1>
491<ul class="simple">
492<li>Plusieurs cas testés pour la fonction</li>
493<li>Lancer l'ensemble des tests == campagne de tests == <cite>test suite</cite></li>
494<li>La fonction est <cite>mariée</cite> Ã  ses tests</li>
495</ul>
496<p><em>Je change la fonction, je revalide les tests</em></p>
497</div>
498<div class="slide" id="id12">
499<h1>Les principes du TDD</h1>
500<p>Encore plus fort: le test est écrit <cite>avant</cite> le code:</p>
501<pre class="literal-block">
502&gt;&gt;&gt; def test_average():
503...     if average(1, 2, 3) == 2:
504...         return 'OK'
505...     else:
506...         return 'Houston we have a problem'
507&gt;&gt;&gt; test_average()
508Traceback (most recent call last):
509...
510NameError: global name 'average' is not defined
511</pre>
512</div>
513<div class="slide" id="id13">
514<h1>Les principes du TDD</h1>
515<p>Le code à présent:</p>
516<pre class="literal-block">
517&gt;&gt;&gt; def average(*args):
518...     return sum(args) / len(args)
519</pre>
520<p>Le test à nouveau:</p>
521<pre class="literal-block">
522&gt;&gt;&gt; test_average()
523'OK'
524</pre>
525<p>-&gt; Les tests devraient être écrits <em>avant</em> le code</p>
526<p>-&gt; Bien souvent ils le sont en même temps ou juste aprÚs</p>
527</div>
528<div class="slide" id="id14">
529<h1>Les principes du TDD</h1>
530<p>Le TDD offre:</p>
531<ul class="simple">
532<li>La <strong>Qualité</strong><ul>
533<li>les développeurs révisent naturellement leur code</li>
534<li>les refontes de code sont plus faciles</li>
535</ul>
536</li>
537<li>La <strong>non-régression</strong>: on relance les tests à chaque modification</li>
538<li><strong>