Algorithms II Software Development Life-Cycle
Problem Solving Problem solving is the process of transforming the description of a problem into the solution of that problem by using our knowledge of the problem domain and by relying on our ability to select and use appropriate problem-solving strategies, techniques, and tools.
Problem Solving Problem Solving Procedure Environment Problem Solution
Problem Solving Solution Input Output A solution is anything that connects the input to the output.
Why Use Computers Use a computer to solve a problem if: It has extensive input. It has extensive output. Its method of solution is too complicated to implement manually. If done manually, it takes an excessively long time to solve. We expect to use the same method often.
Software Development Life Cycle Requirements specification Analysis Design Implementation Testing and verification Documentation Maintenance and Enhancement
Sample Problem: QuikTax Customer: QuikTax, a local tax preparation service. Task: “Develop a program to calculate Federal Tax from the Federal Tax Schedules for the 1999 tax year.”
Requirements Specifications “If you don’t know where you’re going, then any road will take you there. Critical Questions: What is the current situation? What is the desired situation? What constraints limit possible solutions? What special conditions must be met? Goal: complete understanding of problem space and solution space.
QuikTax Requirements Inputs: Output: Constraints: ? Taxpayer income (wages, interest, etc) Schedule data. Output: Tax payment (on form? backup data?) Constraints: ? Special Conditions: April 15? Refunds? Earned Income Credit?
Analysis In this phase we identify: Specific inputs and their forms Specific outputs expected from and their forms Special Constraints Assumptions Formulas
Inputs What items must be provided to be able to get a solution? Taxable income $0.00 to $1,000,000,000.00 (+?) Filing status: S/M, Head of household Number of dependents: 1 - 99? Dividends, interest, capital gains? Deductions, adjustments, … ?
Output Intermediate results Final results All calculations? Completed forms: 1040 Schedules A,B,C,..? Estimated Tax Working papers and justification?
Constraints What are the limits on the data? Income can not be negative. Number of dependents usually one or more (may be zero). Is there a maximum? Filing status must be one of a set of values
Assumptions Problem deals in $US What’s implied by the Requirements?
Formulas For income tax, it is the tax tables and accessory formulas. For determining the area, it is length x width For grades, it is: >90.0% A 80.0% - 89.99% B 70.0% - 79.99% C 60.0% - 69.99% D >60.0% F
Design Develop a series of steps with a logical order which, when applied to the input would produce the specified output. (does this sound like an ALGORITHM?) This phase is when you think about how to solve the problem!! This phase can take forty per cent of the effort.
Design for Maintenance and Enhancement Identify and separate critical data: Use names: RATE = 0.18 use TAX = net_income * RATE not TAX = net_income * 0.18 Functional Decomposition: Identify and group critical functions Taxpayer ID functions Dependent and deduction calculations Special Forms Final Tax obligation Many valid alternative decompositions.
“Design at the Keyboard” is not design. Implementation This is the phase where the design is transformed into code. This is the only portion of the process that is computer and compiler specific. This should be approximately ten per cent of the effort. “Design at the Keyboard” is not design.
Implementation Errors Design errors Design can’t be implemented Matrices too large, not enough precision,… Syntax errors Incorrect language forms Run-time errors Arithmetic errors Unanticipated input
Testing and Verification Once the code is developed: Demonstrate the program produces correct results. Demonstrate that the program that was built solves the problem that was described in the requirements specification. Manually solve the problem with a data set, then compare that to the program’s output Construct an alternate computer solution for special easy-to-implement cases.
Documentation should be a complete explanation of code as implemented. Consists of A concise requirements specification Description of inputs, outputs, constraints, and formulas used Pseudocode or flowchart of the algorithm Source code listing Hard copy of a sample of data and the output User’s guide explaining how to use the program Documentation should be a complete explanation of code as implemented.
Maintenance and Enhancement Environments change, so programs must be changed Tax tables change Name of organization changes Users want (or need) the program to do more New tax credits Elimination of old tax credits.
Design for Maintenance and Enhancement Identify and separate critical data: Use names: RATE = 0.18 use TAX = net_income * RATE not TAX = net_income * 0.18 Changes are easier/Less chance of error Data is in one place/one change changes all Easier to understand. RATE -vs- 0.18
Design for Maintenance and Enhancement Functional Decomposition: Identify and group critical functions Taxpayer ID functions Dependent and deduction calculations Special Forms Final Tax obligation Easier to find and identify code to change. Effects limited to local area.