|
1 | 1 | # Learn to Debug
|
2 | 2 | [//]: # (Version:1.0.0)
|
3 |
| -Debugging is the cornerstone of being a programmer. The first meaning of the verb "debug" is to remove errors, but the meaning that really matters is to see into the execution of a program by examining it. A programmer that cannot debug effectively is blind. |
| 3 | +デバッグはプログラマになるための基礎です。動詞 "debug"の最初の意味はエラーを取り除くことですが、実際に重要な意味は、プログラムの実行を調べて調べることです。効果的にデバッグできないプログラマーは目が見えません。 |
4 | 4 |
|
5 |
| -Idealists, those who think design, analysis, complexity theory, and the like are more fundamental than debugging, are not working programmers. The working programmer does not live in an ideal world. Even if you are perfect, you are surrounded by and must interact with code written by major software companies, organizations like GNU, and your colleagues. Most of this code is imperfect and imperfectly documented. Without the ability to gain visibility into the execution of this code, the slightest bump will throw you permanently. Often this visibility can be gained only by experimentation: that is, debugging. |
| 5 | +理想主義者、設計、分析、複雑さの理論などがデバッグよりも基本的だと考える人は、プログラマーを働かせていません。働くプログラマーは理想的な世界に住んでいません。あなたが完璧であっても、大手ソフトウェア会社、GNUのような組織、およびあなたの同僚によって書かれたコードに囲まれていなければなりません。このコードのほとんどは不完全であり、不完全に文書化されています。このコードの実行を可視化する機能がなければ、わずかなバンプはあなたを永遠に投げ捨てます。多くの場合、この可視性は実験(デバッグ)によってのみ得られます。 |
6 | 6 |
|
7 |
| -Debugging is about the running of programs, not programs themselves. If you buy something from a major software company, you usually don't get to see the program. But there will still arise places where the code does not conform to the documentation (crashing your entire machine is a common and spectacular example), or where the documentation is mute. More commonly, you create an error, examine the code you wrote, and have no clue how the error can be occurring. Inevitably, this means some assumption you are making is not quite correct or some condition arises that you did not anticipate. Sometimes, the magic trick of staring into the source code works. When it doesn't, you must debug. |
| 7 | +デバッグは、プログラムそのものではなく、プログラムの実行に関するものです。あなたが大手ソフトウェア会社から何かを購入した場合、通常はそのプログラムを見ることはできません。しかし、コードがドキュメントに準拠していない場所(マシン全体をクラッシュさせることは一般的で壮大な例です)やドキュメンテーションがミュートされている場所が発生します。より一般的には、エラーを作成し、書き込んだコードを調べ、エラーがどのように発生する可能性があるのか??わかりません。必然的に、これはあなたが作っているという前提がかなり正しくないこと、あるいはあなたが予期していない状態が発生したことを意味します。時には、ソースコードを眺めている魔法がうまく動作することもあります。そうでない場合は、デバッグする必要があります。 |
8 | 8 |
|
9 |
| -To get visibility into the execution of a program you must be able to execute the code and observe something about it. Sometimes this is visible, like what is being displayed on a screen, or the delay between two events. In many other cases, it involves things that are not meant to be visible, like the state of some variables inside the code, which lines of code are actually being executed, or whether certain assertions hold across a complicated data structure. These hidden things must be revealed. |
| 9 | +プログラムの実行を可視化するには、コードを実行してそのコードを観察できる必要があります。画面に表示されているもの、または2つのイベント間の遅延のように、これが目に見えることがあります。多くの場合、コード内のいくつかの変数の状態、実際に実行されているコードの行、または複雑なデータ構造にわたって特定のアサーションが保持されているかどうかなど、目に見えないものが含まれます。これらの隠されたものは明らかにされなければなりません。 |
10 | 10 |
|
11 |
| -The common ways of looking into the ‘innards’ of an executing program can be categorized as: |
| 11 | +実行プログラムの "nnards"を調べる一般的な方法は、次のように分類できます。 |
12 | 12 |
|
13 |
| -- Using a debugging tool, |
14 |
| -- Printlining - Making a temporary modification to the program, typically adding lines that print information out, and |
15 |
| -- Logging - Creating a permanent window into the programs execution in the form of a log. |
| 13 | +- デバッグツールを使用して、 |
| 14 | +- Printlining - プログラムを一時的に変更します。通常、情報を出力する行を追加します。 |
| 15 | +- ロギング - プログラムの実行に永続的なウィンドウをログの形で作成します。 |
16 | 16 |
|
17 |
| -Debugging tools are wonderful when they are stable and available, but printlining and logging are even more important. Debugging tools often lag behind language development, so at any point in time they may not be available. In addition, because the debugging tool may subtly change the way the program executes it may not always be practical. Finally, there are some kinds of debugging, such as checking an assertion against a large data structure, that require writing code and changing the execution of the program. It is good to know how to use debugging tools when they are stable, but it is critical to be able to employ the other two methods. |
| 17 | +デバッギングツールは、安定して利用可能な場合は素晴らしいですが、印刷ライティングとロギングはさらに重要です。デバッグツールは言語開発に遅れをとることが多いため、いつでも利用できない可能性があります。さらに、デバッグツールが微妙にプログラムの実行方法を変更する可能性があるため、必ずしも実際的ではない場合があります。最後に、大きなデータ構造に対するアサーションのチェック、コードの記述、プログラムの実行の変更など、いくつかの種類のデバッグがあります。デバッグツールが安定しているときにデバッグツールを使用する方法を知っておくことは良いことですが、他の2つの方法を使用できることが重要です。 |
18 | 18 |
|
19 |
| -Some beginners fear debugging when it requires modifying code. This is understandable - it is a little like exploratory surgery. But you have to learn to poke at the code and make it jump; you have to learn to experiment on it and understand that nothing that you temporarily do to it will make it worse. If you feel this fear, seek out a mentor - we lose a lot of good programmers at the delicate onset of their learning to this fear. |
| 19 | +いくつかの初心者は、コードを変更する必要があるときにデバッグを恐れています。これは理解できる - それは探索的手術のようなものです。しかし、あなたはコードを突き刺してジャンプさせることを学ばなければなりません。あなたはそれを試して、あなたが一時的に行うことはそれを悪化させるものは何もないことを理解することを学ばなければなりません。この恐怖を感じる場合は、メンターを探してください。この恐怖への敏感な始まりで、多くの優れたプログラマーを失います。 |
20 | 20 |
|
21 | 21 | Next [How to Debug by Splitting the Problem Space](02-How to Debug by Splitting the Problem Space.md)
|
0 commit comments