Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Advertisements

Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
An Introduction to Software Engineering CSCI 3333 Data Structures.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
Testing an individual module
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
Programming Fundamentals (750113) Ch1. Problem Solving
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
BY RAJESWARI S SOFTWARE TESTING. INTRODUCTION Software testing is the process of testing the software product. Effective software testing will contribute.
Data Structures and Programming.  John Edgar2.
Fundamentals of Python: From First Programs Through Data Structures
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Software.
1 Programming and Problem Solving — Software Engineering (Read Chap. 2)
Programming and Problem Solving — Software Engineering (Read Chap. 2) 1.
Fundamentals of Python: First Programs
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
TESTING.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
An Introduction to Software Engineering CSCI 3033 Data Structures.
CMSC 345 Fall 2000 Unit Testing. The testing process.
COP 3530 PROGRAM, FILE & DATA STRUCTURES Syllabus Syllabus Lab Information Lab Information Overrides Overrides Questions? Questions?
Testing Methods Carl Smith National Certificate Year 2 – Unit 4.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
Data Structures and Algorithms Introduction to Algorithms M. B. Fayek CUFE 2006.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Software Reliability. Risks of faulty software  Example: –Therak 25, –AT&T network failure –Airport traffic control  Costs of software errors can be.
1 Program Planning and Design Important stages before actual program is written.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Data Structures Using C++ 2E
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering. Acknowledgement Charles Moen Sharon White Bun Yue.
Intermediate 2 Computing Unit 2 - Software Development.
Software Engineering Saeed Akhtar The University of Lahore.
Data Structure Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2010.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
The Hashemite University Computer Engineering Department
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Chapter 1 Software Development Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Testing Integral part of the software development process.
Software Testing.
Software Testing.
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
Lecture 2 Introduction to Programming
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Unit# 9: Computer Program Development
Programming Fundamentals (750113) Ch1. Problem Solving
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Programming Fundamentals (750113) Ch1. Problem Solving
Lecture 7 Algorithm Design & Implementation. All problems can be solved by employing any one of the following building blocks or their combinations 1.
Programming Fundamentals (750113) Ch1. Problem Solving
Basic Concepts of Algorithm
Software Development Chapter 1.
CHAPTER 6 Testing and Debugging.
Presentation transcript:

Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance Lab 1 1

Problem Analysis and Specification Computer Science programming assignment - specific statement of problem quantitative description clearly defined requirements: input, output, calculations, test data Computer Science programming assignment - specific statement of problem quantitative description clearly defined requirements: input, output, calculations, test data Easy in CS courses, not always in the real world. 2

Problem Analysis and Specification “Real World” request - general statement of problem qualitative not quantitative precision missing for input, output, processing “Real World” request - general statement of problem qualitative not quantitative precision missing for input, output, processing P. 3 3

Statement of specifications  the formal statement of the problem’s requirements  the major reference document  a benchmark used to evaluate the final system The program should display on the screen a prompt for an amount to be depreciated and the number of years over which it is to be depreciated. If should then read these two values from the keyboard. Once it has the amount and the number of years, it should compute the sum of the integers 1, 2,... up to the number of years. It should then display on the screen a table with appropriate headings that shows the year number and the number and the depreciation for that year, for the specified number of years. Sometimes stated precisely using a formal method. 4

Design CS courses –small systems few hundred lines of code simple, straightforward self-contained “Real” world –large systems thousands of lines of code complex many components 5

OCD: Object-Centered Design 1. Identify the objects in the problem's specification and their types. 2. Identify the operations needed to solve the problem. 3. Arrange the operations in a sequence of steps, called an algorithm, which, when applied to the objects, will solve the problem. (OOD: Object-Oriented Design) P. 4 6

Algorithm Data Types Simple Structured — data structures May be written in pseudocode Characteristics of steps (instructions), see pg 9: –Definite and unambiguous –Simple –Finite Difference between correctness and efficiency, see pp 7-8 –O(n) — grows linearly with size (n) of the input –O(1) — is constant, i.e. independent of size of input Should be well-structured Can't separate data structures and algorithms Algorithms + Data Structures = Programs — containers P. 5 7

Algorithm (Structured Version) / * Algorithm to read and count several triples of distinct numbers and print the largest number in each triple. * / 1. Initialize count to Read the first triple of numbers x, y, z. 3. While x is not the end-of-data-flag do the following: a. Increment count by 1. b. If x > y and x > z then display x. Else if y > x and y > z then display y Else display z. c. Read the next triple x, y, z. 4. Display count. 8 Compare with unstructured version

Implementation (Coding) Select language of implementation Encode the design Verify integration –combining program units into a complete software system. Insure quality –programs must be correct, readable, and understandable –well-structured, documented, stylistic (see guidelines on pp ) Why? See p. 15 9

Testing, Execution, and Debugging –Validation: "Are we building the right product?" check that documents, program modules, etc. match the customer's requirements. –Verification: : "Are we building the product right?" check that products are correct, complete, consistent with each other and with those of the preceding phases. 10

Errors may occur in any of the phases –Specifications don't accurately reflect given information or the user's needs/requests –Logic errors in algorithms –Incorrect coding or integration –Failure to handle boundary data or test values 11

Different kinds of tests required –Unit tests: Each individual program unit works? –Program components tested in isolation –Integration tests : Units combined correctly? –Component interface and information flow tested –System tests: Overall system works correctly? 12

The "V" Life Cycle Model 13 Dorothy (Dot) Hoekema Graham -- Grove Consultants (

Unit testing –probably the most rigorous and time-intensive –surely the most fundamental and important –kinds of errors tested: 14 syntax linking run-time logic

Black box or functional test Outputs produced for various inputs are checked for correctness without considering the structure of the program component itself. Program unit is viewed as a black box that accepts inputs and produces outputs, but the inner workings of the box are not visible. 15

White box or structural test Performance is tested by examining code’s internal structure. Test data is carefully selected so that specific parts of the program unit are exercised. 16

Example: Binary search (pp ) /* INCORRECT IMPLEMENTATION OF FUNCTION BinarySearch() performs a binary search of array a for item. Receive: item, array a of n items, sorted in ascending order Pass back: found (true if search successful) and mid ( the position of item in a) */ void BinarySearch(NumberArray a, int n, ElementType item, bool & found, int & mid) { int first = 0, // first and last positions in sublist last = n - 1; // currently being searched * ) found = false; while (first <= last && !found) { mid = (first + last ) / 2; if (item < a[mid]) last = mid; else if (item > a[mid]) first = mid; else found = true } 17

Black box test Use n = 7 and sample array a of integers a[0]=45 a[1]=64 a[2]=68 a[3]=77 a[4]=84 a[5]=90 a[6]=96 Test with item = 77 returns found = true, mid = 3 Test with item = 90 returns found = true, mid = 5 Test with item = 64 returns found = true, mid = 1 Test with item = 76 returns found = false Hey, it seems to work ok! Are we done yet? 18

Boundary Testing Must consider special cases: Boundary values -- at bounds of data structures (not tested above) item = 45: found = true and mid = 0 OK item = 96: doesn’t terminate; must “break” program. ERROR!! Non-member values Fails – infinite loop 19

Techniques to locate error Trace Tables Debugger (GNU gdb -- Lab 1C) Debug statements (p. 21) cerr << "DEBUG: At top of while loop in BinarySearch()\n" << "first = " << first << ", last = " << last << ", mid = " << mid << endl; Output: DEBUG: At top of while loop in BinarySearch() first = 0, last = 6, mid = 3 DEBUG: At top of while loop in BinarySearch() first = 3, last = 6, mid = 4 DEBUG: At top of while loop in BinarySearch() first = 4, last = 6, mid = 5 DEBUG: At top of while loop in BinarySearch() first = 5, last = 6, mid = 5 DEBUG: At top of while loop in BinarySearch() first = 5, last = 6, mid = 5 DEBUG: At top of while loop in BinarySearch() first = 5, last = 6, mid =

White-box test 21 Use knowledge of control flow of program to devise test data. Exercise the different paths of execution to find errors. e.g., Use item < 45 to test a path in which the first condition item < a[mid] is always true so first alternative last = mid ; is always selected. OK! Use item > 96 to test a path in which the second condition item > a[mid] is always true so second alternative first = mid; is always selected. ERROR! Infinite loop

Maintenance –Large % of computer center budgets –Large % of programmer's time –Largest % of software development cost Why? –Includes modifications and enhancements –Poor structure, poor documentation, poor style less likely to catch bugs before release make fixing of bugs difficult and time-consuming impede implementation of enhancements 22

Algorithm (Unstructured Version) / * Algorithm to read and count several triples of distinct numbers and print the largest number in each triple. * / 1. Initialize count to 0 2. Read a triple x, y, z. 3. If x is the end-of-data flag then go to step Increment count by If x > y then go to step If y > z then go to step Display z. 8. Go to step If x < z then go to step Display x. 11. Go to step Display y. 13. Go to step Display count. Note the spaghetti logic! 23