/
index.html
415 lines (377 loc) · 16.4 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<!doctype html>
<html lang="en">
<head>
<title>Large-Scale Software Development with Elisp</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=1024" />
<meta name="description"
content="Large-Scale Software Development with Elisp">
<meta name="author" content="Rocky Bernstein" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<div id="impress">
<div class="no-support-message">
Your browser doesn't support impress.js. Try Chrome or Safari.
</div>
<div id="title" class="step slide with_height" data-scale="5">
<div class="title">
<h2>Large-scale Software Development with Elisp</h2>
</div>
<div id="slide_details">
Rocky Bernstein: <tt>rocky@gnu.org</tt>
</div>
<div id="slide-content">
<ul class>
<li>large program:
<a href="http://github.com/rocky/emacs-dbgr">
https://github.com/rocky/emacs-dbgr</a></li>
<li>linking tool:
<a href="http://github.com/rocky/emacs-load-relative">
https://github.com/rocky/emacs-load-relative</a></li>
<li>unit test:
<a href="http://github.com/rocky/emacs-test-unit">
https://github.com/rocky/emacs-test-unit</a></li>
<li>talk text:
<a href="http://github.com/rocky/rocky.github.com/wiki/NYC-Lisp-Elisp-talk">
https://github.com/rocky/rocky.github.com/wiki/NYC-Lisp-Elisp-talk</a>
</li>
<li>slides (what you see here):
<a href="http://rocky.github.com/NYC-Lisp-Elisp-talk">
http://rocky.github.com/NYC-Lisp-Elisp-talk</a>
</li>
</ul>
</div>
<div class="hint">
<p>Use a spacebar or arrow keys to navigate</p>
</div>
<script>
if ("ontouchstart" in document.documentElement) {
document.querySelector(".hint").innerHTML = "<p>Tap on the left or right to navigate</p>";
}
</script>
</div>
<div id="talk-overview" class="step slide" data-x="5000" data-scale="3">
<div class="slide-content">
<h3>Talk Overview</h3>
<ul class="lv0_indent">
<li>
<a href="https://github.com/rocky/emacs-dbgr/wiki/Debconf2010-emacs-pydbgr.ogv">Short GUD rewrite demo</a></li>
<li>Development Requirements</li>
<li>Internal vs. External linking
<li>Testing framework
<li>Questions, where to go from here?
</ul>
</div>
</div>
<div id="require" class="step" data-x="10000" data-y='0'
data-scale="3">
<div class="slide-content">
<h3>Development Requirements</h3>
<p>Here are the things that are important to me:
<ul class="lv0_indent">
<li>Of course, I use GNU Emacs.</li>
<li>I need to be able to break this program into small chunks or modules.
</ul></p>
</div>
</div>
<div id="require2a" class="step" data-x="10000" data-y="2000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements</h3>
<p>Here are the things that are important to me:
<ul class="lv0_indent">
<li>Of course, I use GNU Emacs.</li>
<li>I need to be able to break this program into small chunks or modules.
<br><em>Implication</em>: there may be many files.
</li>
</ul></p>
</div>
</div>
<div id="require3" class="step" data-x="10000" data-y="4000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements</h3>
<p>Here are the things that are important to me:
<ul id="lv0_indent">
<li>Of course, I use GNU Emacs.</li>
<li>I need to be able to break this program into small chunks or modules.
<br><em>Implication</em>: there may be many files.
</li>
<li>I need to be able to run and debug each check in isolation.
</ul></p>
</div>
</div>
<div id="require3a" class="step slide" data-x="10000" data-y="6000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements</h3>
<p>Here are the things that are important to me:
<ul class="lv0_indent">
<li>Of course, I use GNU Emacs.</li>
<li>I need to be able to break this program into small chunks or modules.
<br><em>Implication</em>: there may be many files.
</li>
<li>I need to be able to run and debug each test in isolation.
<br><em>Implication</em>: each module needs to have enough information to pull in whatever other modules it needs
</li>
</ul>
</p>
</div>
</div>
<div id="require4" class="step slide" data-x="10000" data-y="8000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements</h3>
<p>Here are the things that are important to me:
<ul class="lv0_indent">
<li>Of course, I use GNU Emacs.</li>
<li>I need to be able to break this program into small chunks or modules.
<br><em>Implication</em>: there may be many files.
</li>
<li>I need to be able to run and debug each test in isolation.
<br><em>Implication</em>: each module needs to have enough information to pull in whatever other modules it needs
</li>
<li>I want quick development turnaround (edit,test,run...)</li>
</ul>
</p>
</div>
</div>
<div id="require4a" class="step slide" data-x="10000" data-y="10000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements</h3>
<p>Here are the things that are important to me:
<ul class="lv0_indent">
<li>Of course, I use GNU Emacs.</li>
<li>I need to be able to break this program into small chunks or modules.
<br><em>Implication</em>: there may be many files.
</li>
<li>I need to be able to run and debug each test in isolation.
<br><em>Implication</em>: each module needs to have enough information to pull in whatever other modules it needs
</li>
<li>I want to reduce the development loop.
<br><em>Implications:
<ul>
<li> This means reducing the amount of "compilation" time</li>
<li>it means I don't want to have to "install" code to try modules I am interested in.</li>
<li>I may have an "installed" version and a "development" version and ...</li>
<li>I want to be able to run from the "development" code with little overhead.</li>
</ul></em>
</li>
</ul>
</p>
</div>
</div>
<div id="require5" class="step slide" data-x="10000" data-y="12000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements Continued...</h3>
<ul class="lv0_indent">
<li>I need to be able to test each module in isolation.</li>
<li>I need to be run all tests often.</li>
<li>Test modules are still modules, so see above.</li>
</ul>
</div>
</div>
<div id="require5a" class="step slide" data-x="10000" data-y="14000"
data-scale="3">
<div class="slide-content">
<h3>Development Requirements Continued...</h3>
<ul class="lv0_indent">
<li>I need to be able to test each module in isolation.</li>
<li>I need to be able in batch</li>
<li>Test modules are still modules, so see above.</li>
<br><em>Implications:
<ul>
<li>Because there are many files there are many tests</li>
<li>Tests need to be able to be run interactively</li>
<li>Tests need to be run in batch
</ul></em>
</ul>
</div>
</div>
<div id="Linking" class="step slide" data-x="15000" data-y="0"
data-scale="3">
<div id="slide-content">
<h2>The Internal/External Linking Problem</h3>
<p>
A (large) Emacs Lisp program uses modules from many places. Some
modules reside inside and some outside.
<p><em>Example</em>: location positioning might be such a thing.
</div>
</div>
<div id="c-linking" class="step slide" data-x="20000" data-y="0"
data-scale="3">
<div id="slide-content">
<h2>C #includes</h2>
<div class="slide-content">
<p>Interestingly the very old language, C, got it right. Consider:
<table class="CodeRay"><tr>
<td class="code"><pre><span class="preprocessor">#include</span> <span class="include">"stdio.h"</span>
</pre></td>
</tr></table>
which can also be written as:
<table class="CodeRay"><tr>
<td class="code"><pre><span class="preprocessor">#include</span> <span class="include">"./stdio.h"</span>
</pre></td>
</tr></table>
versus:
<table class="CodeRay"><tr>
<td class="code"><pre><span class="preprocessor">#include</span> <span class="include"><stdio.h></span>
</pre></td>
</tr></table>
</div>
</div>
</div>
<div id="ruby-linking" class="step slide" data-x="25000" data-y="0"
data-scale="3">
<div id="slide-content">
<h2>Ruby requires</h2>
<div class="slide-content">
<p>In Ruby 1.9.<em>x</em>:
<table class="CodeRay"><tr>
<td class="code"><pre>require <span class="string"><span class="delimiter">'</span><span class="content">rubygems</span><span class="delimiter">'</span></span>
</pre></td>
</tr></table>
versus:
<table class="CodeRay"><tr>
<td class="code"><pre>require_relative <span class="string"><span class="delimiter">'</span><span class="content">rubygems</span><span class="delimiter">'</span></span>
</pre></td>
</tr></table>
</div>
</div>
</div>
<div id="evil-load-path" class="step slide" data-x="30000" data-y="0"
data-scale="3">
<div id="slide-content">
<h2>load-path is evil</h2>
<div class="slide-content">
<p>In Emacs Lisp we have <tt>load-path</tt> which is consulted in <tt>load()</tt> and <tt>require()</tt>.</p>
<p>Problems with <tt>load-path</tt>
<ul>
<li>It is insecure</li>
<li>It is complex</li>
<li>It is fragile</li>
</ul>
</p><em>Show curent load-path</em>
</div>
</div>
</div>
<!-- <div id="load-relative" class="step slide" data-x="35000" data-y="0" -->
<!-- data-scale="3"> -->
<!-- <div id="slide-content"> -->
<!-- <h2>load-relative</h2> -->
<!-- <div class="slide-content"> -->
<!-- <p>I wrote <a href="http://github.com/rocky/emacs-load-relative">emacs-load-relative</a> for internal linking. In its simplest form:</p> -->
<!-- <table class="CodeRay"><tr> -->
<!-- <td class="code"><pre>(<span class="keyword">require</span> 'load-relative) <span class="comment">; pull in (load-relative)</span> -->
<!-- (load-relative <span class="string"><span class="delimiter">"</span><span class="content">my-module</span><span class="delimiter">"</span></span>) -->
<!-- (load-relative <span class="string"><span class="delimiter">"</span><span class="content">./my-module</span><span class="delimiter">"</span></span>) <span class="comment">; same thing</span> -->
<!-- </pre></td> -->
<!-- </tr></table> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<div id="load-relative2" class="step slide" data-x="40000" data-y="0"
data-scale="3">
<div id="slide-content">
<h2>load-relative</h2>
<div class="slide-content">
<p>I wrote <a href="http://github.com/rocky/emacs-load-relative">emacs-load-relative</a> for internal linking. In its simplest form:</p>
<table class="CodeRay"><tr>
<td class="code"><pre>(<span class="keyword">require</span> 'load-relative) <span class="comment">; pull in (load-relative)</span>
(load-relative <span class="string"><span class="delimiter">"</span><span class="content">my-module</span><span class="delimiter">"</span></span>)
(load-relative <span class="string"><span class="delimiter">"</span><span class="content">./my-module</span><span class="delimiter">"</span></span>) <span class="comment">; same as above</span>
(load-relative <span class="string"><span class="delimiter">"</span><span class="content">my-module</span><span class="delimiter">"</span></span> 'dbgr) <span class="comment">; find under 'dbgr
</pre></td>
</tr></table>
<p>A real example from <a href="https://github.com/rocky/emacs-dbgr/blob/master/dbgr/debugger/trepan.pl/init.el">emacs-dbgr/debugger/trepan.pl/init.el</a>:
<table class="CodeRay"><tr>
<td class="code"><pre>
(require-relative-list '(<span class="string"><span class="delimiter">"</span><span class="content">../../common/regexp</span><span class="delimiter">"</span></span>
<span class="string"><span class="delimiter">"</span><span class="content">../../common/loc</span><span class="delimiter">"</span></span>
<span class="string"><span class="delimiter">"</span><span class="content">../../common/init</span><span class="delimiter">"</span></span>)
<span class="string"><span class="delimiter">"</span><span class="content">dbgr-</span><span class="delimiter">"</span></span>)
</pre></td>
</tr></table>
</div>
</div>
</div>
<div id="testing" class="step slide" data-x="45000" data-y="0000"
data-scale="3">
<div class="slide-content">
<h3>Testing</h3>
Relatively Recent Schools of Testing
<ul class="lv0_indent">
<li>Test Driven Development (<a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a>).
</li>
<li>Behavior Driven Development (<a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">BDD</a>)</li>
</ul>
<p>Some Test frameworks. See <a href="http://www.emacswiki.org/emacs/UnitTesting">http://www.emacswiki.org/emacs/UnitTesting:</a>
<ul class="lv0_indent">
<li><a href="http://www.emacswiki.org/emacs/ElkTest">http://www.emacswiki.org/emacs/ElkTest</a></li>
<li><a href="http://www.emacswiki.org/emacs/ErtTestLibrary"</a>http://www.emacswiki.org/emacs/ErtTestLibrary</li>
<li><a href="https://github.com/rocky/emacs-test-unit"</a>https://github.com/rocky/emacs-test-unit</a></li>
</ul>
</div>
</div>
<div id="emacs-test-unit" class="step slide" data-x="50000" data-y="0000"
data-scale="3">
<div class="slide-content">
<h3>Emacs Test Unit</h3>
<p>I have <a href="https://github.com/rocky/emacs-dbgr/tree/master/test">39 tests for over 90 Emacs Lisp</a> files. This is more than <a href="http://bzr.savannah.gnu.org/lh/emacs/emacs-24/files/head:/test/automated/">Emacs 24 using <em>elr</em></a>.
<p>Let's now dive into a test from <em>emacs-dbgr</em>, specifically one for <a href="https://github.com/rocky/emacs-dbgr/blob/master/test/test-regexp-gdb.el">testing <em>gdb</em> regular expressions</a>:
</div>
</div>
<div id="emacs-test-unit2" class="step slide" data-x="55000" data-y="0000"
data-scale="3">
<div class="slide-content">
<h3>Emacs Test Unit Example</h3>
<p><a href="https://github.com/rocky/emacs-dbgr/blob/master/test/test-regexp-gdb.el">Testing <em>gdb</em> regular expressions</a>:
<table class="CodeRay"><tr>
<td class="code"><pre>(<span class="keyword">require</span> 'test-unit)
(<span class="keyword">load-file</span> <span class="string"><span class="delimiter">"</span><span class="content">../dbgr/common/buffer/command.el</span><span class="delimiter">"</span></span>)
(<span class="keyword">load-file</span> <span class="string"><span class="delimiter">"</span><span class="content">../dbgr/debugger/gdb/init.el</span><span class="delimiter">"</span></span>)
...
(test-unit-clear-contexts)
...
(specify <span class="string"><span class="delimiter">"</span><span class="content">basic location</span><span class="delimiter">"</span></span>
(assert-t (numberp (loc-match text))))
...
(test-unit <span class="string"><span class="delimiter">"</span><span class="content">regexp-gdb</span><span class="delimiter">"</span></span>)
</pre></td>
</tr></table>
</p><em>Go through example</em>
</div>
</div>
<div id="batch-test" class="step slide" data-x="60000" data-y="0000"
data-scale="3">
<div class="slide-content">
<h3>Running in Batch</h3>
<pre>
$ remake --tasks # shows what targets are around
CTAGS
ChangeLog
...
check
check-am
check-recursive
check-short # Run all tests without bloated output
$ cd test
$ make check-short
Running specs tagged "bp":
.
0 problems in 1 specification using 1 assertions. (0 seconds)
</pre>
</div>
</div>
<div id="TheEnd" class="step slide" data-x="65000" data-y="0" data-rotate="180" data-scale="3">
<div id="slide-details">
<h3>The End... Thanks!</h3>
</div>
</div>
<script type="text/javascript" src="impress.js"></script>
</body>
</html>