-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
188 lines (170 loc) · 5.74 KB
/
index.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
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Комментарии — зло</title>
<meta charset="utf-8">
<meta name="viewport" content="width=792, user-scalable=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet" href="shower/themes/bright/styles/screen.css">
</head>
<body class="list">
<header class="caption">
<h1>Комментарии — зло</h1>
<p><a href="https://github.com/vast">Василий Половнёв</a>, безработный</p>
</header>
<section class="slide" id="Cover"><div>
<h2>Комментарии — зло</h2>
<p>Пожалуйста, хватит</p>
<p class="note">Василий Половнёв, безработный</p>
</div></section>
<section class="slide">
<div>
<h2>В этом выступлении не обсуждаются</h2>
<ul>
<li>Clojure</li>
<li>Функциональный Подход</li>
<li>FreeBSD</li>
<li>Erlang</li>
</ul>
</div>
</section>
<section class="slide">
<div>
<h2>Какие бывают комментарии</h2>
<ul>
<li>закомментированный код;</li>
<li>капитанские;</li>
<li>комментарии-зарубки;</li>
<li>вонючие.</li>
</ul>
</div>
</section>
<section class="slide">
<div>
<h2>Закомментированный код</h2>
<pre>
<code>// var fibonacci = function(n) {</code>
<code>// if (n < 2){</code>
<code>// return 1;</code>
<code>// } else {</code>
<code>// return fibonacci(n-2) + fibonacci(n-1);</code>
<code>// }</code>
<code>// }</code>
<code>finallyMakeSomethingUseful();</code>
</pre>
</div>
</section>
<section class="slide">
<div>
<h2>Закомментированный код</h2>
<p>Мешает чтению и пониманию <em>кода</em>, увеличивает риск пропустить работающий код.</p>
<p>Удаляйте без сомнений. Понадобится — возьмете из истории Гита.</p>
</div>
</section>
<section class="slide">
<div>
<h2>Капитанские комментарии</h2>
<pre>
<code><mark><!-- header --></mark> <header id="header"></code>
</pre>
<pre>
<code><mark>// close connection</mark></code>
<code>connection.close();</code>
</pre>
<pre>
<code><mark>// if connection status is 0</mark></code>
<code>if (connection.status === 0)</code>
</pre>
</div>
</section>
<section class="slide">
<div>
<h2>Капитанские комментарии</h2>
<p>Объясняют очевидное: <em>что</em> делает код. В них нет ни смысла, ни пользы, а глаз спотыкается.</p>
<p>Удаляйте. Или выражайте мысль в коде:</p>
<pre>
<code>if (connection.status === 0) → if (<mark>connection.isOpen()</mark>)</code>
</pre>
</div>
</section>
<section class="slide">
<div>
<h2>Комментарии-зарубки</h2>
<pre>
<code>// TODO: move it somewhere else</code>
</pre>
<pre>
<code>// FIXME: sorry, I didn't have enough time to fix it properly</code>
</pre>
</div>
</section>
<section class="slide">
<div>
<h2>Комментарии-зарубки</h2>
<p>Отвлекают, заставляют чувствовать себя виноватым.</p>
<p>Технический долг. Выносите такие комментарии в трекеры задач: Джира, Трелло, Бейскамп.</p>
</div>
</section>
<section class="slide">
<div>
<h2>Вонючие комментарии</h2>
<pre>
<code><mark>// 38 — line height in Firefox</mark></code>
<code>delta = event.deltaY * 38</code>
</pre>
<pre>
<code><mark>// make the user admin in the current project</mark></code>
<code>var membership = account.memberships.where({ userId: user.id }).first() </code>
<code>account.roles</code>
<code> .where({ membershipId: membership.id }</code>
<code> .updateAll(...))</code>
</pre>
</div>
</section>
<section class="slide">
<div>
<h2>Вонючие комментарии</h2>
<p>Пытаются оправдать херовый код. Признак того, что вы не смогли выразить свою мысль ясно в коде.</p>
<p>Удаляйте и рефакторите код.</p>
</div>
</section>
<section class="slide">
<div>
<h2>Вонючие комментарии</h2>
<pre>
<code><del>// 38 — line height in Firefox</del></code>
<code>delta = event.deltaY * <mark>LINE_HEIGHT_IN_FIREFOX</mark></code>
</pre>
<pre>
<code><del>// make the user admin in the current project</del></code>
<code><mark>this.makeCurrentUserAdminInCurrentProject()</mark></code>
<code><del>var membership = account.memberships.where({ userId: user.id }).first()</del></code>
<code><del>...</del></code>
</pre>
</div>
</section>
<section class="slide shout">
<div>
<h2 style="text-align: center; font-size: 80px">
Комментарии — зло
</h2>
</div>
</section>
<section class="slide">
<div>
<h2>Спасибо</h2>
<p>
Пишите код, удаляйте комментарии, любите маму.
</p>
<p>
<a href="https://twitter.com/vazilla">twitter.com/vazilla</a><br />
<a href="mailto:[email protected]">[email protected]</a>
</p>
</div>
</section>
<div class="progress"><div></div></div>
<script src="shower/shower.min.js"></script>
<!-- Copyright © 2014 Yours Truly, Famous Inc. -->
<!-- Photos by John Carey, fiftyfootshadows.net -->
</body>
</html>