Problem Solving and Design
Problem Solving and Design
KEY DEFINITIONS
Computer system: Made up of software, data, hardware, communications and people
Test data: A set of test data is the data required to work through a solution
Trace table: A trace table can be used to record the results from each step in an algorithm; it is used to
record the value of an item (variable) each time it changes.
Top-down design: Top-down design is the breaking down of a computer system into set of sub
systems, then breaking each sub-system down into a set of smaller sub systems, until each subsystem
just performs a single action.
Decomposition: The process of breaking down a large task into smaller tasks.
Structure design: In order to show top-down design in a diagrammatic form, structure diagrams can be
used. The structural diagram shows the design of a computer system in a hierarchical way, with each
level giving a more detailed breakdown of the system into sub-system.
Library routines: It is a set of programming instructions for a given task that is already available for use.
It is pre-tested and usually performs a task that is frequently required. For example, a library routine
could create random numbers. The main program can use this library routine whenever a random
number needs to be generated.
Sub routines: It is a set of programming instructions for a given task that forms a sub-system not the
whole system. Sub-routines written in high-level programming languages are called procedures or
functions. For example, a game might include a subroutine to display a high-score table.
Page 1 of 4
This can be represented diagrammatically as structure diagram.
SMARTPHONE
Example 2: A finance office needs an algorithm to calculate weekly pay. The algorithm needs to
determine how many normal hours and how many overtime hours each employee works. Overtime is
paid at 1.5 times the normal hourly rate. An employee’s total weekly pay should be output at the end.
PAY
Page 2 of 4
VALIDATION AND VERIFICATION
VALIDATION: Validation is the automatic checking by a program that data is reasonable before it is accepted
into computer system. Different types of checks may be used on same piece of data.
VERIFICATION: Verification is checking that data has been accurately copied onto the computer or transferred
from one part of computer to another.
VERIFICATION VALIDATION
Range check Double entry (data entry)
Length check Screen/visual check (data entry)
Type check Parity check (data transmission)
Format check Checksum (data transmission)
Presence check
Check digit
Limit check
Consistency check
Lookup table
Example 2: Explain using examples, the differences between verification and validation when data is
entered into a computer.
Verification: an age of above 100 should be accepted
Validation: typing in a password twice
Page 3 of 4
TEST DATA AND ITS TYPES
To test a program, each section of the code is run using sample data. This sample data is called test
data.
The following types of test data should be used to make sure a program is bug-free.
Common errors:
Students often say: “extreme data is large values that are rejected”; this is incorrect as all extreme data
should be accepted.
Statements such as ‘all test data was accepted’ or ‘all test data worked’ are never worth any marks
since they don’t say what type of test data was used; it is necessary to state the type of test data and
whether it should be accepted or rejected.
Page 4 of 4