09-testing-formal-methods

09-testing-formal-methods - How To Write Better Code CSE...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
How To Write Better Code CSE 114 SUNY at Stony Brook 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
“As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.” — Maurice Wilkes, designer of EDSAC, on programming, 1949 "If builders built buildings the way programmers write programs, then the first woodpecker that came along would destroy civilization." — Weinberg's Second Law. 2
Background image of page 2
The Mariner I space probe was launched from Cape Canaveral on 28 July 1962 towards Venus. After 13 minutes' flight a booster engine would give acceleration up to 25,820 mph; after 44 minutes 9,800 solar cells would unfold; after 80 days a computer would calculate the final course corrections and after 100 days the craft would circle the unknown planet, scanning the mysterious cloud in which it is bathed. However, with an efficiency that is truly heartening, Mariner I plunged into the Atlantic Ocean only four minutes after takeoff. Inquiries later revealed that a minus sign had been omitted from the instructions fed into the computer. "It was human error", a launch spokesman said. This minus sign cost £4,280,000. — Stephen Pile, "The Book of Heroic Failures" 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Outline of Topics Test-First Development Debugging Strategies Formal Methods “In every non-trivial program there is at least one bug.” — Unix fortune 4
Background image of page 4
Testing 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Why Should I Test? According to the U.S. National Institute of Standards & Technology, software bugs cost the U.S. economy about $59.5 billion/year The longer bugs remain in a program, the more costly it is to remove them In industry, testing/QA consumes 50% of development time/effort Good strategies for testing and debugging will reduce your overall workload and improve your programming efficiency 6
Background image of page 6
Basic Terminology Bug — An error in a program Testing — the process of analyzing and executing a program to determine whether it has bugs Debugging — the process of locating a bug and removing it Good strategies for testing and debugging will reduce your overall workload and improve your programming efficiency 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Types of Bugs “Bohr-bugs” Easy to reproduce Therefore, easy to fix “Heisenbugs” Difficult to reproduce Ex. race conditions Harder to locate and fix 8
Background image of page 8
Programming goal: “Make it work” Testing Goal: “Make it fail” Testing is designed to uncover flaws in a program before it is released Testing is a systematic attempt to find faults This is NOT the same as ensuring that faults are not present! 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 42

09-testing-formal-methods - How To Write Better Code CSE...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online