-
Notifications
You must be signed in to change notification settings - Fork 0
/
presentation.html
197 lines (190 loc) · 5.98 KB
/
presentation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<link href="file:///usr/local/rvm/gems/ruby-2.0.0-p247/gems/slippery-0.0.1/assets/reveal.js/css/reveal.min.css" rel="stylesheet">
<link href="file:///usr/local/rvm/gems/ruby-2.0.0-p247/gems/slippery-0.0.1/assets/reveal.js/css/theme/default.css" rel="stylesheet">
</head>
<body>
<div class="reveal"><div class="slides">
<section><h2>Ruby, tests, code review and automation.</h2>
<p>Christophe Philemotte, BRUG 5 Nov 2013</p>
</section><section>
<h3>About me</h3>
<ul>
<li><p>Developer</p></li>
<li><p>founder and C?O of 8th Color</p></li>
<li><p>PullReview</p></li>
</ul>
</section><section>
<h3>Ruby is Dynamic typing</h3>
<pre class="language-Ruby"><code>x = false
x = 3
x = 'this is a string'
</code></pre></section><section>
<h3>and strong typing</h3>
<pre class="language-Ruby"><code>x = '3'
x = x + 3
# TypeError: no implicit conversion of Fixnum into String
</code></pre>
</section><section>
<h3>Ruby is Duck typing</h3>
<pre class="language-Ruby"><code>class Duck
def quack
puts 'Quaaaaaack!'
end
end
class Person
def quack
puts 'The person imitates a duck.'
end
end
donald = Duck.new
john = Person.new
duck.quack
john.quack
# Quaaaaaack!
# The person imitates a duck.
</code></pre>
<p>from Wikipedia</p>
</section><section>
<h3>Getting Weak Typing with Duck Typing</h3>
<pre class="language-Ruby"><code>class Fixnum
alias_method :old_plus, :+
def new_plus(other)
return self.to_s + other if other.kind_of? String
self.old_plus(other)
end
alias_method :+, :new_plus
end
x = '3'
y = 3 + x
</code></pre>
</section><section>
<h3>With Great Freedom</h3>
<ul>
<li><p>Meaningfull & Concise</p></li>
<li><p>Flexible & Contract Based</p></li>
<li><p>Easy DI</p></li>
</ul>
</section><section>
<h3>Comes Great Risk</h3>
<ul>
<li><p>Error Only at Runtime</p></li>
<li><p>No Static Interface</p></li>
<li><p>You shouldn’t care of the type, but …</p></li>
</ul>
</section><section>
<h3>How to Mitigate?</h3>
<ul>
<li><p>Writing Tests</p></li>
<li><p>Code Review</p></li>
<li><p>Automation</p></li>
</ul>
</section><section>
<h3>Tests Benefits</h3>
<ul>
<li><p>Check the Contract and the User Story</p></li>
<li><p>Reliable Changes through Time</p></li>
<li><p>Documentation of the Code</p></li>
<li><p>Guards against Regression and Edge Cases</p></li>
<li><p>Speed the dev Cycle</p></li>
</ul>
</section><section>
<h3>Tests Framework</h3>
<ul>
<li><p>Test:Unit</p></li>
<li><p>MiniTest</p></li>
<li><p>Rspec</p></li>
<li><p>Cucumber</p></li>
</ul>
</section><section>
<h3>Continuous Integration</h3>
<p><img src="images/everytime-you-break-the-build.png" alt="kitty"></p>
</section><section>
<h3>Continuous Integration</h3>
<ul>
<li><p>Jenkins</p></li>
<li><p>Travis</p></li>
<li><p>CodeShip</p></li>
<li><p>Semapore</p></li>
</ul>
</section><section>
<h3>Code Review is a Discussion</h3>
<p><img src="images/code-review.png" alt="discussion"></p>
<h3>Code Review Benefits</h3>
<ul>
<li><p>Knowledge Sharing</p></li>
<li><p>Mutual Education in the Team</p></li>
<li><p>Bug Detection before Shipping</p></li>
<li><p>Readability and Consistency Improvement</p></li>
<li><p>CoOwnership Reinforcement</p></li>
<li><p>Shorter Dev/Test Cycles</p></li>
</ul>
</section><section>
<h3>Code Review Benefits</h3>
<blockquote><p>60% of all issues raised in the code inspections are not problems that could<br>
have been uncovered by latter phases of testing or field usage because they<br>
have little or nothing to do with the visible execution behavior of the<br>
software.<br>
(H. Siy and L. Votta 2001)</p></blockquote>
</section><section>
<h3>Code Review Tools</h3>
<ul>
<li><p>GitHub PullRequest</p></li>
<li><p>Gerrit</p></li>
<li><p>Collaborator</p></li>
<li><p>Crucible</p></li>
</ul>
</section><section>
<h3>Automated Code Review Benefits</h3>
<blockquote><p>Automation is necessary. It is common to take a sort of smug satisfaction in<br>
reports of colossal failures of automatic systems, but for every failure of<br>
automation, the failures of humans are legion.</p></blockquote>
</section><section>
<h3>Automated Code Review Benefits</h3>
<blockquote><p>Exhortations to “write better code” plans for more code reviews, pair<br>
programming, and so on just don’t cut it, especially in an environment with<br>
dozens of programmers under a lot of time pressure. The value in catching<br>
even the small subset of errors that are tractable to static analysis every<br>
single time is huge.<br>
John Carmack, 2011</p></blockquote>
</section><section>
<h3>Automated Code Review Benefits</h3>
<ul>
<li><p>Short Feedback Time and NOW!</p></li>
<li><p>None Emotional Influences</p></li>
<li><p>Tracking Progress</p></li>
<li><p>Reproducible, Invariable</p></li>
<li><p>Don’t Waste Peer Time, Spent time on Complicated.</p></li>
</ul>
</section><section>
<h3>Automated Code Review Tools</h3>
<ul>
<li><p>Ruby Warning (Linter)</p></li>
<li><p>Flog (Complexity)</p></li>
<li><p>Flay (Duplication)</p></li>
<li><p>Excellent (a Medley)</p></li>
<li><p>Rails Best Practices (specific to Rails)</p></li>
<li><p>Brakeman (Security)</p></li>
<li><p>Rubocop (Style and Linter)</p></li>
<li><p>Yard (Documentation)</p></li>
</ul>
</section><section>
<h3>Automated Code Review Tools</h3>
<ul>
<li><p>CodeClimate</p></li>
<li><p>PullReview</p></li>
</ul>
<p><img src="images/review.png" alt="Review"></p>
</section><section>
<h3>Conclusion</h3>
<ul>
<li><p>Start right now</p></li>
<li><p>Setup one thing at a time with your team</p></li>
<li><p>It’s an incremental and team process</p></li>
<li><p>There are complementary strategies</p></li>
</ul></section>
</div></div>
<script src="file:///usr/local/rvm/gems/ruby-2.0.0-p247/gems/slippery-0.0.1/assets/reveal.js/lib/js/head.min.js" type="text/javascript"></script><script src="file:///usr/local/rvm/gems/ruby-2.0.0-p247/gems/slippery-0.0.1/assets/reveal.js/js/reveal.js" type="text/javascript"></script><script>Reveal.initialize({ dependencies: [], });</script>
</body>
</html>