Planning for the Solution Lesson 3 McManusCOP10061.
-
Upload
brandon-jenkins -
Category
Documents
-
view
213 -
download
0
Transcript of Planning for the Solution Lesson 3 McManusCOP10061.
![Page 1: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/1.jpg)
COP1006 1
Planning for the Solution
Lesson 3
McManus
![Page 2: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/2.jpg)
COP1006 2
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!
McManus
![Page 3: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/3.jpg)
COP1006 3
Solutions
• Don’t reinvent the wheel!• Use solutions that have been
– already proven successful – been created just to be reused
McManus
![Page 4: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/4.jpg)
COP1006 4
Solution Trade Offs
• Speed• Readability• Understandability• Maintainability• Reusability
McManus
We take these into consideration every time we create a program.
![Page 5: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/5.jpg)
COP1006 5
How the Computer Stores Data
• Files– Program – set of instructions– Data – raw pieces of facts
McManus
database
records
Data (fields)
files
![Page 6: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/6.jpg)
COP1006 6
Hierarchy of a DBMS
McManus
DBMS
Database Management Systemmade up of one or more databases
DB
A databasemade up of one or more tables, queries, forms, reports, etc
Tableinformation related to one topicmade up of one or more records Rooms Instructors
Record
information related to one specific entitymade up of one or more fields Inventory Classes
Field
information related to one specific part of an entitymade up of one particular data type
Item NameItem Number
Student NameStudent ID
NWF State College
FWB
ExampleDefinition
![Page 7: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/7.jpg)
COP1006 7
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”
McManus
![Page 8: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/8.jpg)
COP1006 8
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
McManus
![Page 9: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/9.jpg)
COP1006 9
Software Life Cycle
McManus
Problem Definition
Software & Architectural DesignSystemRequirements Detailed Design
SpecificationsDesign Validation
Coding*Testing/
AcceptanceOperations/
Maintenance
Indicates= reiterative steps after testing and verification of each phase
*Implementation
The Waterfall Model
![Page 10: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/10.jpg)
COP1006 10
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.
McManus
![Page 11: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/11.jpg)
COP1006 11
PAC Payroll Example
Given Data Required ResultsHoursPayRate
Gross Pay
Processing Required Solution AlternativesGrossPay = Hours * PayRate Define the Hours Worked and Pay
Rate as constantsDefine the Hours Worked and Pay Rate as variablesDefined the Hours Worked and Pay Rate as input values
McManus
![Page 12: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/12.jpg)
COP1006 12
Structure Charts
McManus
Calculate Gross Pay
ObtainInput Values
Calculate Gross Pay
Print Pay Check
PR
HRS PR
HRSGP
GP
*Includes data flow
![Page 13: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/13.jpg)
COP1006 13
Interactivity Charts
McManus
Calculate Gross Pay
ObtainInput Values
Calculate Gross Pay
Print Pay Check
*Includes data flow
Hourly Rate
Hours Worked
![Page 14: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/14.jpg)
COP1006 14
Input Processing Output (IPO)
Input Processing Output
Hours WorkedPay Rate
1. Enter Hours Worked
2. Enter Pay Rate
3. Calculate Pay
4. Print Pay
Gross Pay (the pay check)
McManus
![Page 15: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/15.jpg)
COP1006 15
Flowchart
• Originally used to describe the entire program.
• Now, used to define – selection (decision) and – repetition (looping) structures
McManus
![Page 16: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/16.jpg)
COP1006 16
Flowchart Symbols
• Flowlines– used when direction is in doubt
• Start/(End/Stop/Exit)• Processing• I(input)/O(output)• Decision
McManus
Begin End
Calculate Gross Pay
Print Pay Check
MoreEmployees?
![Page 17: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/17.jpg)
COP1006 17
Example Flowchart
McManus
Snoozeor Off?
Alarm goes off!
Sleep or Get up?
Zzzzz!
Snooze
Sleep
Get Dressed. . .
Snooze= 9?
< 9
Ignore Alarm, Forget Boss,
Forget Instructor – Probably creating a problem?
![Page 18: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/18.jpg)
COP1006 18
Pseudocode
• Everything is included, but written in English rather than any one language’s syntax
• Useful for debugging• Ex.
McManus
Obtain PayRateObtain HoursWorkedGrossPay equals PayRate Multiplied by HoursWorkedPrint GrossPay
![Page 19: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/19.jpg)
COP1006 19
Documentation
• Internal• External
• Written in different language styles
McManus
![Page 20: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/20.jpg)
COP1006 20
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
McManus
' 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
![Page 21: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/21.jpg)
COP1006 21
External Documentation
• Manuals or Help menus to assist the user– Includes
• User Manuals• System Manuals
• User must be able to understand…
McManus
Make text bold
1. Select the text you want to change.
2. Click Bold on the Formatting Toolbar.
![Page 22: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/22.jpg)
COP1006 22
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
McManus
![Page 23: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/23.jpg)
COP1006 23
Coding
• After determining that the solution is correct
• Select the appropriate language• Code the program
McManus
![Page 24: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/24.jpg)
COP1006 24
Testing
• Test the coded solution• Best done by someone other than
the programmer
McManus
![Page 25: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/25.jpg)
COP1006 25
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.
McManus
![Page 26: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/26.jpg)
COP1006 26
Where to Place the Blame?
• Nowhere!It is not the
purpose to place blame when a fault is found…
Only to fix the fault!
McManus
![Page 27: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/27.jpg)
COP1006 27
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.
McManus
![Page 28: Planning for the Solution Lesson 3 McManusCOP10061.](https://reader030.fdocuments.in/reader030/viewer/2022032707/56649e4d5503460f94b43a8b/html5/thumbnails/28.jpg)
COP1006 28McManus
Next?