Skip to content

Commit 3fd3e70

Browse files
committed
Add a few general notes to the introduction
1 parent e9038ad commit 3fd3e70

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

00-introduction.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,20 @@ <h2 id="learning-objectives"><span class="glyphicon glyphicon-certificate"></spa
3939
</ul>
4040
</div>
4141
</section>
42-
<p>These notes are still in a draft stage and several bits and pieces (in particular introductions and summaries) are still missing.</p>
42+
<p>This lesson serves as a brief introduction to the following topics (each well worthy of a lesson of their own):</p>
43+
<ul>
44+
<li><strong>testing</strong>: the process of making sure that a program does what it is suppposed to do. Achieved by 1) writing code (a <em>test</em>) that runs a part of the main code and compares the result to the expected result and 2) automatizing the process of running those tests.</li>
45+
<li><strong>debugging</strong>: the process of finding the source of errors in the code, in particular with the help of a <em>symbolic debugger</em>.</li>
46+
<li><strong>profiling</strong>: the first step of optimizing the execution speed of a program by measuring its runtime. These measures can be taken on various levels, e.g.: the complete runtime of the full code or a part of it; the runtime for each function in the code; the runtime of each line of code in a function.</li>
47+
</ul>
48+
<p>A simplified process of code development, involving all the three elements can look like the following:</p>
49+
<ol style="list-style-type: decimal">
50+
<li>Write code that solves a specific problem</li>
51+
<li>Write <em>tests</em> for that code, showing that it actually solves the problem (taking special care of corner and edge cases)</li>
52+
<li>When tests fail, <em>debug</em> the code to find the root cause.</li>
53+
<li>If the code runs too slowly for the purpose at hand, <em>profile</em> it to find out where the time is spent and optimize the code (using the test suite to verify that everything is still working correctly)</li>
54+
</ol>
55+
<p>Some developers recommend to switch step 1 and 2 around, i.e. to actually write the tests <em>before</em> the code (therefore starting with a test suite full of failing tests). This is called <a href="https://en.wikipedia.org/wiki/Test-driven_development">test-driven development</a> and adopting it at least partially is certainly a good idea: whenever a bug occurs, writing first a test that reliably fails can dramatically help in the later stages of debugging it.</p>
4356
</div>
4457
</div>
4558
</article>

00-introduction.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,35 @@ minutes: 5
88
> * Know the meaning of testing, debugging, profiling
99
> * Understand their place in the scientific workflow
1010
11-
These notes are still in a draft stage and several bits and pieces (in
12-
particular introductions and summaries) are still missing.
11+
This lesson serves as a brief introduction to the following topics (each well
12+
worthy of a lesson of their own):
13+
14+
* **testing**: the process of making sure that a program does what it is suppposed
15+
to do. Achieved by 1) writing code (a *test*) that runs a part of the main
16+
code and compares the result to the expected result and 2) automatizing the
17+
process of running those tests.
18+
* **debugging**: the process of finding the source of errors in the code, in
19+
particular with the help of a *symbolic debugger*.
20+
* **profiling**: the first step of optimizing the execution speed of a program
21+
by measuring its runtime. These measures can be taken on various levels, e.g.:
22+
the complete runtime of the full code or a part of it; the runtime for each
23+
function in the code; the runtime of each line of code in a function.
24+
25+
A simplified process of code development, involving all the three elements can
26+
look like the following:
27+
28+
1. Write code that solves a specific problem
29+
2. Write *tests* for that code, showing that it actually solves the problem
30+
(taking special care of corner and edge cases)
31+
3. When tests fail, *debug* the code to find the root cause.
32+
4. If the code runs too slowly for the purpose at hand, *profile* it to find out
33+
where the time is spent and optimize the code (using the test suite to
34+
verify that everything is still working correctly)
35+
36+
Some developers recommend to switch step 1 and 2 around, i.e. to actually write
37+
the tests *before* the code (therefore starting with a test suite full of
38+
failing tests). This is called
39+
[test-driven development](https://en.wikipedia.org/wiki/Test-driven_development)
40+
and adopting it at least partially is certainly a good idea: whenever a bug
41+
occurs, writing first a test that reliably fails can dramatically help in the
42+
later stages of debugging it.

0 commit comments

Comments
 (0)