280 likes | 376 Views
Planning for the Solution. Lesson 3. Computers are Dumb!. You have to tell them what to do what to use in what order to do it and what to do if your user does not do what you want them to do!. Solutions. Don’t reinvent the wheel! Use solutions that have been
E N D
Planning for the Solution Lesson 3 COP1006
Computers are Dumb! • You have to tell them • what to do • what to use • in what order to do it and • what to do if your user does not do what you want them to do! COP1006
Solutions • Don’t reinvent the wheel! • Use solutions that have been • already proven successful • been created just to be reused COP1006
Solution Trade Offs • Speed • Readability • Understandability • Maintainability • Reusability We take these into consideration every time we create a program. COP1006
Data (fields) database records files How the Computer Stores Data • Files • Program – set of instructions • Data – raw pieces of facts COP1006
Hierarchy of a DBMS COP1006
Terminology • Semantics • The concept or idea of the item • Ex. The numeral three is an idea that humans have established representing the concept of three items • Syntax • The physical/visible representation of the idea • Ex. “three” “3” COP1006
Organizing the Problem • Tools • Algorithms • Problem Analysis Chart (PAC) • Structure/Interactivity Charts • Input Processing Output (IPO) Chart • Flowcharts • Hierarchy Charts • But…first we have to understand the Software Life Cycle COP1006
Problem Definition Software & Architectural Design System Requirements Detailed Design Specifications Design Validation Coding* Testing/ Acceptance Operations/ Maintenance Indicates = reiterative steps after testing and verification of each phase *Implementation Software Life Cycle The Waterfall Model COP1006
Analyzing the Problem • Understand the Problem • Analyze the Requirements of the Problem • Figure out what will be the outcome Very often we’re not given the inputs to a problem, only the desired output. COP1006
PAC Payroll Example COP1006
Calculate Gross Pay PR HRS GP GP PR HRS Print Pay Check Calculate Gross Pay ObtainInput Values Structure Charts Don't we wish! *Includes data flow COP1006
Interactivity Charts Calculate Gross Pay Print Pay Check Calculate Gross Pay ObtainInput Values Don't we wish! Hourly Rate Hours Worked *Includes data flow COP1006
Input Processing Output (IPO) COP1006
Flowchart • Originally used to describe the entire program. • Now, used to define • selection (decision) and • repetition (looping) structures COP1006
Flowchart Symbols • Flowlines • used when direction is in doubt • Start/(End/Stop/Exit) • Processing • I(input)/O(output) • Decision End Begin Calculate Gross Pay Print Pay Check MoreEmployees? COP1006
Example Flowchart Zzzzz! Alarm goes off! Snooze = 9? Snooze or Off? < 9 Snooze Sleep or Get up? Ignore Alarm, Forget Boss, Forget Instructor – Probably creating a problem? Sleep Get Dressed. . . COP1006
Pseudocode • Everything is included, but written in English rather than any one language’s syntax • Useful for debugging • Ex. Obtain PayRateObtain HoursWorkedGrossPay equals PayRate Multiplied by HoursWorkedPrint GrossPay COP1006
Documentation • Internal • External • Written in different language styles COP1006
Internal Documentation • Used to explain what is being done (and why) within the program • Most often takes the form of comments within the program • Written in Language that Programmer, not user, will understand ' Insert a new node in the binary search tree. ' If the root node is null, create the root node here. ' Otherwise, call the insert procedure of class TreeNo COP1006
External Documentation • Manuals or Help menus to assist the user • Includes • User Manuals • System Manuals • User must be able to understand… • Make text bold • Select the text you want to change. • Click Bold on the Formatting Toolbar. COP1006
Debugging the Solution • Walkthroughs • Walking through the process to verify that the solution • is solving the right problem and • works correctly • You can use any of the charts or Pseudocode for this step • Helps find bugs COP1006
Coding • After determining that the solution is correct • Select the appropriate language • Code the program COP1006
Testing • Test the coded solution • Best done by someone other than the programmer COP1006
60% to 70% of all Faults • found in large-scale software projects are specification and design faults. • Where do most of these faults originate? • Not fully understanding the problem and • then creating a specification based on an erroneous problem definition. • Industry’s high priority • involves the development and use of techniques that will help find faults during the earliest phases. COP1006
Where to Place the Blame? • Nowhere! It is not the purpose to place blame when a fault is found… Only to fix the fault! COP1006
With team development… • new problems arise, such as: • different styles of writing code, • interface difficulties, • different declared types (integer vs real) • different understandings of the problem caused by communication problems, and • even something as simple as the order in which variables are listed within a procedure’s call statement. COP1006
Next? Programming Structure COP1006