没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Morgan Kaufmann Publishers is an imprint of Elsevier
30 Corporate Drive, Suite 400
Burlington, MA 01803
This book is printed on acid-free paper.
⬁
Copyright © 2009 by Elsevier Inc. All rights reserved.
Designations used by companies to distinguish their products are often claimed as trademarks or
registered trademarks. In all instances in which Morgan Kaufmann Publishers is aware of a claim, the
product names appear in initial capital or all capital letters. Readers, however, should contact the
appropriate companies for more complete information regarding trademarks and registration.
No part of this publication may be reproduced,stored in a retrieval system,or transmitted in any form
or by any means, electronic, mechanical, photocopying, scanning, or otherwise, without prior written
permission of the publisher.
Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in
Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333, e-mail: permissions@elsevier.com.
You may also complete your request on-line via the Elsevier homepage (http://elsevier.com), by
selecting “Support & Contact” then “Copyright and Permission”and then “Obtaining Permissions.”
Library of Congress Cataloging-in-Publication Data
Application submitted.
ISBN-13: 978-0-12-374515-6
For information on all Morgan Kaufmann publications,
visit our Website at www.books.elsevier.com
Printed in the United States
0809101112 10987654321
Foreword
In Federalist 51, James Madison wrote:“If men were angels, no government would
be necessary.” If he lived today, Madison might have written: “If software devel-
opers were angels, debugging would be unnecessary.” Most of us, however, make
mistakes, and many of us even make errors while designing and writing software.
Our mistakes need to be found and fixed, an activity called debugging that origi-
nated with the first computer programs. Today every computer program written
is also debugged, but debugging is not a widely studied or taught skill. Few books,
beyond this one, present a systematic approach to finding and fixing programming
errors.
Be honest: Does debugging seem as important, difficult, or worthy of study as
writing a program in the first place? Or, is it just one of those things that you need
to do to finish a project? Software developers though spend huge amounts of time
debugging—estimates range up to half or more of their workdays. Finding and fixing
bugs faster and more effectively directly increases productivity and can improve
program quality by eliminating more defects with available resources. Preventing
mistakes in the first place would be even better, but no one has yet found the
technique to prevent errors, so effective debugging will remain essential.
Improved programming languages and tools can supplant, but not eliminate,
debugging, by statically identifying errors and by dynamically detecting invariant
violations. For example, the type system in modern languages such as Java and
C# prevents many simple mistakes that slip by C programmers. Moreover, these
languages’ runtime bounds checks stop a program when it strays out of bounds,
which may be billions of instructions before the error manifests itself. Unfortunately,
there are countless ways in which a program can go wrong, almost all of which
languages and tools cannot detect or prevent. For example, in recent years there
has been considerable work in verifying sequences of operations in a program.Tools
can ensure that a file is opened before a program reads it, but they cannot check
that the correct file is accessed or that the program properly interprets its contents.
If either mistake occurs, someone still must debug the program to understand the
error and determine how to fix it.
In addition, debugging can be an enjoyable activity that shares the thrill of the
hunt and chase found in a good detective novel or video game. On the other hand,
a protracted, unsuccessful search for a bug in your code quickly loses its charm,
particularly when your boss is asking repeatedly about your (lack of ) progress.
Learning to debug well is essential to enjoying software development.
This book can teach you how to debug more effectively. It is a complete and
pragmatic overview of debugging, written by a talented researcher who has devel-
oped many clever ways to isolate bugs. It explains best practices for finding and
fixing errors in programs,ranging from systematically tracking error reports, repro-
ducing failures, observing symptoms, isolating the cause, and correcting defects.
Along with basic techniques and commonly used tools, the book also explores the
xv
xvi Foreword
author’s innovative techniques for isolating minimal input to reproduce an error
and for tracking cause and effect through a program.
Studying this book will make you a better programmer. You will be able to find
and fix errors in your code (and your colleague’s code) faster and more effectively,
a valuable skill that will enable you to finish projects earlier and produce programs
with fewer defects. Also, if you read between the lines you will learn how to write
code that is more easily tested and debugged, which further increases your ability
to find and correct defects. And thinking hard about what can go wrong with your
program can help you avoid mistakes in the first place,so you have less to debug.
James Larus
Microsoft Research
Preface
This is a book about bugs in computer programs—how to reproduce them, how
to find them, and how to fix them such that they do not occur. This book teaches
a number of techniques that allow you to debug any program in a systematic, and
sometimes even elegant, way. Moreover, the techniques can be widely automated,
which allows you to let your computer do most of the debugging. Questions this
book addresses include:
■ How can I reproduce failures faithfully?
■ How can I isolate what is relevant for the failure?
■ How does the failure come to be?
■ How can I fix the program in the best possible way?
■ How can I learn from mistakes to prevent future ones?
Once you understand how debugging works,you will not think about debugging
in the same way. Instead of seeing a wild mess of code, you will think about causes
and effects,and you will systematically set up and refine hypotheses to track failure
causes. Your insights may even make you set up your own automated debugging
tool. All of this allows you to spend less time on debugging, which is why you are
interested in automated debugging in the fir st place, right?
How This Book Came to Be Written
Although I work as a researcher, I have always considered myself a programmer,
because this is how I spend most of my time. During programming, I make mis-
takes, and I have to debug my code. I would like to say that I am some type of
überprogrammer—that I never make mistakes—but I am only human, just like
anyone else.
During my studies,I have learned that an ounce of prevention is more than worth
a pound of cure. I have learned many ways of preventing mistakes. Today, I teach
them to my students. However,in striving for prevention we must not forget about
the cure. If we were doctors,we could not simply refuse treatment just because our
patient had not taken all possible preventive measures.
So, rather than designing yet another ultimate prevention, I have sought good
cures. This same pragmatic attitude has been adopted by other researchers around
the globe. I am happy to report that we have succeeded. Today, a number of
advanced debugging techniques are available that widely automate the debugging
process.
These techniques not only automate debugging, but also turn debugging from
a black art into a systematic and well-organized discipline that can be taught just
like any software engineering topic. Thus, I created a course on automated debug-
ging and reworked the lecture notes into a book. The result is what you see
before you.
xvii
剩余387页未读,继续阅读
资源评论
chenlong789
- 粉丝: 3
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Sora AI Video Preview Case Sora AI 视频模版项目,React全栈快速部署.zip
- Foobar2000 中文完全版
- 基于JAVA web 的酒店管理系统的设计与实现,MySQL、MVC
- cdf6be7eb5ee2c1204e6de3b08a441d2.jpg
- 基于web的停车场管理系统的设计与实现、MVC、前台jQuery、后台JDBC,JSP技术,Tomcat、JavaBean
- 基于STM32和QT平台的农业大棚远程监控系统设计.pdf
- 毕业设计-基于SpringBoot、JPA、Thmleaf实现的旅游网站管理系统
- index.wxml
- 基于Git的软件项目管理配置方法及应用实践.pdf
- 基于R语言的公立医院学科绩效评估数据可视化研究.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功