Chapter 7
Chapter 7
Topics to be covered:
1. Program development life cycle(PDLC)
2. Computer system and subsystem
3. Problem decomposition
4. Methods used to design/construct solution for problem
5. Purpose of an algorithm
6. Standard methods of solution:
• Linear search
• Bubble sort
• Totalling
• Counting
• Finding average, maximum and minimum from data
7. Validation check
8. Verification check
9. Different types of test data/Tracetable
10. Writing,amending,identifying ,Correcting errors
7.1 Program development life cycle(PDLC)
Analysis
Maintenance Design
Testing Coding
Phases of program development
1. Analysis:
• Clearly define your problem
• Requirement specification
• Decomposition –Breaking down a problem in smaller parts
2. Design
• Formal documentation
• Structure chart
• Flow chart
• Pseudocode
3. Coding
• Programing language to build program
Phases of program development
4. Testing
Whole program will be tested using different sets of test data
• Validation
• Verification
• Error correction
5. Maintenance
• Documentation
7.2.2 Decomposing a problem Analysis
→ 𝐶𝑙𝑒𝑎𝑟 𝐷𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛
→ 𝑅𝑒𝑞𝑢𝑖𝑟𝑚𝑒𝑛𝑡
Breaking down of a
problem
Big Task
Task 1 Task 2
Task 1
7.2.2 Decomposing a problem
• Components in which a problem can be decomposed:
1. INPUTS → Data used by the system That needs to be entered while
the system is active
1. Time to set alarm 1. Clock time= Alarm 1. Make Sound/tune 1. Times for alarm set
2. Remove previous time [at alarm time and
alarm 2. Store and Remove after snooze expires]
3. Switching off alarm alarm time
4. Press snooze button 3. Management of
snooze
7.6 Testing
• Repeated use of a system to try all different possibilities to make sure that the system is:
• fully working
1. Range check
2. Length check
3. Type check
4. Presence check
5. Format check
6. Digit check
• Range check • Type check • Format check
A type of validation check It check if the data is it checks if data
that makes sure data is in correct datatype. meets a specific
between maximum and order, e.g. 1 Number
minimum range 3 letters
• Check Digit
• Presence check
• Length check Error detection method
it checks if data has that is used for data entry.
It checks the number of been entered
characters within a set limit
§ Process:
1. Check the first element of the array . Compare if it is the target element x .
4. If the target element is not found and there is no more item left in the array then
output that the element was not found.
#Iterate from 0 to N-1 and compare the value of every index with x, if they match return
index
Num←[20,43,32,12,18,4,16,8,40,99]
x←4
Num 20 43 32 12 18 4 16 8 40 99
index 0 1 2 3 4 5 6 7 8 9
First pass:
Swap
Swap
Swap
j j+1
Pseudocode:
1. Data_array ← [ 5,3,4,2]
2. Number_of_passes ← 0
3. Changes ← False
4. WHILE Changes = False OR Number_of_passes <= LENGTH(Data_array)-1
5. FOR i ← 0 to LENGTH(Data_array)-1
6. IF Data_array[i] > Data_array[i+1] THEN
7. Temp ← Data_array[i]
8. Data_array[i] ← Data_array[i+1]
9. Data_array[i+1] ← Temp
10. Change ← TRUE
11. ENDIF
12. NEXT I
13. Number_of_passes ← Number_of_passes + 1
14. Changes ← False
15. ENDWHILE