1. Trang chủ
  2. » Công Nghệ Thông Tin

Debug It! potx

216 2,1K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 216
Dung lượng 1,53 MB

Nội dung

[...]... following: • The difference between debugging and “making the bug go away” • The empirical approach—using the software itself to show you what’s going on • The core debugging process (reproduce, diagnose, fix, reflect) • First things first—things to think about before diving in 1.1 Debugging Is More Than “Making the Bug Go Away” Ask an inexperienced programmer to define debugging, and they might answer that... problem that needs fixing in the first place? And how does debugging integrate into the wider software development process? Debug- Fu”: In the third and final part, we’ll turn our attention to a number of advanced topics: • Although the approaches discussed earlier in the book apply to all bugs, certain types of bugs benefit from special treatment • Debugging starts long before the irate telephone call from... your toolbox—allow it to show you what’s going on The method described in the next section leverages this approach to provide a structured means of zeroing in on your quarry 1.3 The Core Debugging Process The core of the debugging process consists of four steps: Reproduce: Find a way to reliably and conveniently reproduce the problem on demand 17 F IRST T HINGS F IRST Diagnose: Construct hypotheses, and... is most obvious in the “Not Invented Here” syndrome in which we end up implementing something ourselves when a perfectly good solution already exists elsewhere The debugging equivalent of this mistake is assuming that you have to personally debug every problem you encounter Asking other team members whether they’ve seen something similar before is very low cost and yet has the potential to short-circuit... empirical approach, tends to be by far the most productive Empiricism relies upon observation or expeConstruct experiments, rience, rather than theory or pure logic In and observe the results the context of debugging, this means directly observing the behavior of the software Yes, you could read the entire source code and use pure reason to work out what’s going on (and on occasion you may have no other choice),... front within the combustion chambers during ignition? It is exactly this kind of trick that we are able to perform with our software, which is why the empirical approach is particularly powerful when debugging but doing so is usually inefficient and dangerous You can track the problem down much more effectively by carefully constructing experiments and observing how the software behaves Not only is... zeroing in on the root cause of a bug, whereas others thrash around apparently aimlessly and without concrete results What separates the first group from the second? In this chapter, we will examine a debugging method that has been repeatedly proven in the trenches of professional software development It’s not a silver bullet—you’re still going to have to rely on your intellect, intuition, detective... problem, this is an iterative process Lessons learned during diagnosis might suggest ways to improve your reproduction, or those learned when implementing a fix might cause you to reconsider your diagnosis Debugging is an iterative process We’ll go into each of these steps in much more detail in the following chapters Before then, however, there are a few preliminaries to get out of the way 1.4 First Things... formal bug report, it should already contain all the information you need (We’ll talk about bug What is happening, and what should? 18 F IRST T HINGS F IRST Reproduce Diagnose Fix Reflect Figure 1.1: Core debugging method reports in more detail in Chapter 6, Discovering That You Have a Problem, on page 95.) Take the time to read it carefully to make sure you understand it If you don’t have a formal bug... Problem at a Time It’s sometimes tempting, when faced with several problems, to work on them in parallel This is especially true if the bugs are all in the same general area Don’t give in to this temptation Debugging is difficult enough without “muddying the waters” unnecessarily However careful you are, there’s a good chance that the experiments you perform to try to track down one bug will interfere in some . Saying About Debug It! Paul does an excellent job of explaining the technical, intel lectual, and psychological aspects of all phases of debugging: preventing. ce. Allan McLeod Founder and CTO, Isaacc Software Debug It! does a great job of setti ng the scene for debugging and get- ting you into the r i ght mind-set

Ngày đăng: 15/03/2014, 15:20

Xem thêm