Book contents
- Frontmatter
- Contents
- 1 Introduction
- 2 What Are Good Programs?
- 3 How to Get Started
- 4 How to Understand Your Language
- 5 How to Use the Best Tools
- 6 How to Make Sure You Don’t Lose Your Program
- 7 How to Test Your Program
- 8 How to Make Your Program Clear
- 9 How to Debug Your Program
- 10 How to Improve Your Program
- 11 How to Get Help (without Cheating)
- 12 How to Score Well in Coursework
- 13 How to Score Well in a Programming Exam
- 14 How to Choose a Programming Language
- 15 How to Go Beyond This Book
- Bibliography
- Index
9 - How to Debug Your Program
Published online by Cambridge University Press: 10 July 2020
- Frontmatter
- Contents
- 1 Introduction
- 2 What Are Good Programs?
- 3 How to Get Started
- 4 How to Understand Your Language
- 5 How to Use the Best Tools
- 6 How to Make Sure You Don’t Lose Your Program
- 7 How to Test Your Program
- 8 How to Make Your Program Clear
- 9 How to Debug Your Program
- 10 How to Improve Your Program
- 11 How to Get Help (without Cheating)
- 12 How to Score Well in Coursework
- 13 How to Score Well in a Programming Exam
- 14 How to Choose a Programming Language
- 15 How to Go Beyond This Book
- Bibliography
- Index
Summary
Sometimes your program has some specific problem, or bug: perhaps it fails to compile, or perhaps there is a situation in which it does not do what you want. This chapter helps you approach this difficult situation systematically: localising, understanding and removing the bug, and finally, taking action to reduce your chance of introducing a similar bug again. It discusses common problems, including non-termination and null pointer exceptions, and helpful techniques such as cardboard debugging and defensive programming.
Keywords
- Type
- Chapter
- Information
- How to Write Good ProgramsA Guide for Students, pp. 101 - 133Publisher: Cambridge University PressPrint publication year: 2020