Design - programming Cmpe 450 Fall 2008. Dynamic Analysis Software quality Design carefully from the start Simple and clean Fewer errors Finding errors.

Slides:



Advertisements
Similar presentations
Lecture 8: Testing, Verification and Validation
Advertisements

Dynamic Typing COS 441 Princeton University Fall 2004.
Chapter 3.5 Debugging Games
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
(Quickly) Testing the Tester via Path Coverage Alex Groce Oregon State University (formerly NASA/JPL Laboratory for Reliable Software)
Software testing.
API Design CPSC 315 – Programming Studio Fall 2008 Follows Kernighan and Pike, The Practice of Programming and Joshua Bloch’s Library-Centric Software.
Software Engineering and Design Principles Chapter 1.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing 2.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
Eiffel Language and Design by Contract Contract –An agreement between the client and the supplier Characteristics –Expects some benefits and is prepared.
CODING Research Data Management. Research Data Management Coding When writing software or analytical code it is important that others and your future.
CS1101: Programming Methodology Aaron Tan.
Computer Science 340 Software Design & Testing Design By Contract.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
1 Shawlands Academy Higher Computing Software Development Unit.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
Programming Translators.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
ICAPRG301A Week 4Buggy Programming ICAPRG301A Apply introductory programming techniques Program Bugs US Navy Admiral Grace Hopper is often credited with.
Structured programming 4 Day 34 LING Computational Linguistics Harry Howard Tulane University.
1 The Software Development Process  Systems analysis  Systems design  Implementation  Testing  Documentation  Evaluation  Maintenance.
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim.
Testing and Debugging Session 9 LBSC 790 / INFM 718B Building the Human-Computer Interface.
Verification and Validation Assuring that a software system meets a user's needs.
The Software Development Process
Chapter 8 Lecture 1 Software Testing. Program testing Testing is intended to show that a program does what it is intended to do and to discover program.
Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Scientific Debugging. Errors in Software Errors are unexpected behaviors or outputs in programs As long as software is developed by humans, it will contain.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
CSI 1340 Introduction to Computer Science II Chapter 1 Software Engineering Principles.
SWE 4743 Abstract Data Types Richard Gesick. SWE Abstract Data Types Object-oriented design is based on the theory of abstract data types Domain.
TESTING FUNDAMENTALS BY K.KARTHIKEYAN.
Programming & Debugging. Key Programming Issues Modularity Modifiability Ease of Use Fail-safe programming Style Debugging.
CompSci 100E 18.1 Testing and Debugging Robert A Wagner.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Defensive Programming. Good programming practices that protect you from your own programming mistakes, as well as those of others – Assertions – Parameter.
Defect testing Testing programs to establish the presence of system defects.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Testing and Debugging UCT Department of Computer Science Computer Science 1015F Hussein Suleman March 2009.
Testing and Debugging PPT By :Dr. R. Mall.
C++ Plus Data Structures
Chapter 9, Testing.
Chapter 8 – Software Testing
Topics: jGRASP editor ideosyncrasies assert debugger.
Software Design and Development
Chapter 18 Software Testing Strategies
Software testing strategies 2
Chapter 15 Debugging.
Chapter 15 Debugging.
CSE 303 Concepts and Tools for Software Development
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Computer Science 340 Software Design & Testing
Chapter 7 Software Testing.
Chapter 15 Debugging.
Defensive Programming
Chapter 15 Debugging.
Presentation transcript:

Design - programming Cmpe 450 Fall 2008

Dynamic Analysis Software quality Design carefully from the start Simple and clean Fewer errors Finding errors introduced in coding Dynamic techniques Executing program and observe its behaviour

Static Analysis Ensure quality before execution Design evaluation Code analysis Manual reviews, tools

Dynamic Techniques Rush through specs and designs Fix up later Design and implementation mixed, hard to find errors Cost of fixing an error is higher at later stages

Static Techniques All errors can not be caught statistically “testing can reveal the presence of errors but never their absence”

Defensive Programming To increase reliability of the program by inserting redundant checks Invariants Runtime assertions Testing invariants explicitly

Defensive Programming To make code bug free in the most effective way. Always better to write a good code from scratch than fixing a bad code When to write runtime assertions? As you write the code, not later...

Runtime Assertions- guidelines Check the precondition at the start of the procedure No room for misunderstandings about interfaces between procedures Check the postcondition Self check Write assertions when operation is about to be performed that has some external effect

Runtime assertions- mistakes Runtime assertions slow execution down Write them in testing and turn them off in the official release? WRONG WRONG PRACTICE

Debugging

Debugging is the least predictable software development activity. One usually doesn’t know in advance whether finding the next bug will take five minutes or five weeks. Some people debug using their intuition. From the nature of the symptom, they can go directly to the parts of the program that are most likely to contain the error. While such intuition is useful and can be developed if you learn from experience, it is not necessary; there is a general approach to debugging that does not need it.

General Approach When you run a buggy program on some test data, initially everything is all right (variables have the right values, the right output is produced, control takes the expected path). Things go wrong after a point in time at which a buggy statement is executed. One can identify the buggy statement by identifying this point in time. This of course requires the programmer to be able to tell what the right values of variables are at every point in the program. For programmers other than the original authors, and sometimes even for them, this requires documentation of what the code is meant to do. If this is missing, it has to be recreated.

The suspect period The suspect period is initially the entire run, the whole sequence of statements executed by the program. At some point in the middle of the run, you can check whether everything is all right. If not, you can eliminate the part of the suspect period after the point; the first bug is before that point. There may also be bugs after that point, but you should look for them after the first bug is fixed. If yes, you can eliminate the part of the suspect period before the point; the first bug detectable by this test case is after that point. Any bugs before that point need another test case.

Binary Search

Approximating binary search

Minimizing the failed test case

Diagnostic printfs

Debuggers

Forward Execution

Choosing breakpoints

Breakpoints on functions

Global variables

Tracking errors to their source

Core files

Wild pointer errors

Laws of debugging

Some possibly untrue assumptions

Fixing bugs

Type safety

The magical number seven

Coping with complexity

Abstraction

Modules

Undersanding modular programs

Information hiding

Language support

Declaration vs definition

Type safety convention, part 1

Quiz Is there type safety in C? Explain yes or no on the sample piece of code. What is the problem with this code?

Example

C’s lack of type safety

The problem