-
Notifications
You must be signed in to change notification settings - Fork 3
/
06-debugging-introduction.html
58 lines (58 loc) · 3.84 KB
/
06-debugging-introduction.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title>Software Carpentry: Debugging</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="css/swc.css" />
<link rel="alternate" type="application/rss+xml" title="Software Carpentry Blog" href="http://software-carpentry.org/feed.xml"/>
<meta charset="UTF-8" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="lesson">
<div class="container card">
<div class="banner">
<a href="http://software-carpentry.org" title="Software Carpentry">
<img alt="Software Carpentry banner" src="img/software-carpentry-banner.png" />
</a>
</div>
<article>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<a href="index.html"><h1 class="title">Debugging</h1></a>
<h2 class="subtitle">Introduction</h2>
<blockquote>
<h2 id="quote-by-brian-kernighan">Quote by Brian Kernighan</h2>
<p>“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?”</p>
</blockquote>
<p>Everyone writing programs will be debugging them at some point, i.e. trying to find out why an error or an otherwise unexpected results occurs.</p>
<p>Some general remarks and strategies for debugging can be found in the <a href="http://swcarpentry.github.io/python-novice-inflammation/09-debugging.html">section on debugging in the “Programming with Python” software carpentry lesson</a>. To quickly summarize some of the principles:</p>
<ul>
<li><strong>Narrow things down</strong>: try to reproduce the bug with simplified data, simplified processing, be sure you know what the correct result would be in that situation. Have a set of explicit steps that reproduce the bug <em>every time</em> (if possible).</li>
<li><strong>Change things systematically</strong>: change one thing at a time and test it before moving on</li>
<li><strong>Keep track of what you’ve done</strong>: version control is a great tool to explore possible fixes and not to worry about making things worse – if it did not work out, simply go back to the stored state.</li>
</ul>
<p>The tools presented in this part of the lesson can be helpful in narrowing down where and under what circumstances bugs occur and can therefore save you time in finding the source for a bug. Still, they are just <em>tools</em>, following the principles laid out in the lesson referenced above is much more important than an in-depth knowledge of these tools.</p>
</div>
</div>
</article>
<div class="footer">
<a class="label swc-blue-bg" href="http://software-carpentry.org">Software Carpentry</a>
<a class="label swc-blue-bg" href="https://github.com/paris-swc/python-testing-debugging-profiling">Source</a>
<a class="label swc-blue-bg" href="mailto:[email protected]">Contact</a>
<a class="label swc-blue-bg" href="LICENSE.html">License</a>
</div>
</div>
<!-- Javascript placed at the end of the document so the pages load faster -->
<script src="http://software-carpentry.org/v5/js/jquery-1.9.1.min.js"></script>
<script src="css/bootstrap/bootstrap-js/bootstrap.js"></script>
<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
</body>
</html>