Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance
Problem Analysis and Specification Computer Science programming assignment - specific statement of problem quantitative description clearly defined requirements for needed: input, output, calculations, test data Computer Science programming assignment - specific statement of problem quantitative description clearly defined requirements for needed: input, output, calculations, test data
Problem Analysis and Specification “Real World” request - general statement of problem qualitative (“more accurate”) not quantitative precision missing for input, output, processes “Real World” request - general statement of problem qualitative (“more accurate”) not quantitative precision missing for input, output, processes
Statement of specifications the formal statement of the problem’s requirements the major reference document a benchmark used to evaluate the final system
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
Object-centered design 1. Identify the objects in the problem's specification. 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.
Algorithm May be written in pseudo-code 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
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.
Implementation 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 )
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.
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
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?
The "V" Life Cycle Model
Unit testing –probably the most rigorous and time-intenstive –surely the most fundamental and important –kinds of errors tested — syntax — linking — run-time — logical
Black box or functional test Outputs produced for various inputs are checked for correctness without considering the structure of the module 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.
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.
Example: Binary search (pp )
Black box test Use n = 7 and sample array a of integers
Boundary Testing
Techniques to locate error
White-box test
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