0% found this document useful (0 votes)
34 views

Problem Solving and Design

This document defines key terms related to problem solving and design such as computer systems, test data, trace tables, top-down design, decomposition, structure diagrams, library routines, and subroutines. It describes the steps to take in top-down design including breaking down problems into smaller tasks. Examples are provided of using top-down design to represent systems like a smartphone or payroll calculation diagrammatically. Benefits of top-down design include modularity and parallel development. Validation and verification techniques are defined, and different types of test data are described.

Uploaded by

Rayyan Ahsan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Problem Solving and Design

This document defines key terms related to problem solving and design such as computer systems, test data, trace tables, top-down design, decomposition, structure diagrams, library routines, and subroutines. It describes the steps to take in top-down design including breaking down problems into smaller tasks. Examples are provided of using top-down design to represent systems like a smartphone or payroll calculation diagrammatically. Benefits of top-down design include modularity and parallel development. Validation and verification techniques are defined, and different types of test data are described.

Uploaded by

Rayyan Ahsan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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.

STEPS TO BE FOLLOWED WHILE MAKING A TOP-DOWN DESIGN


To solve a large problem, break the problem into several smaller tasks and work on each task
separately
To solve each task, treat it as a new problem that can be broken down into smaller problems
Repeat this process with each new task until each can be solved without further need of
decomposition.
EXAMPLES OF TOP-DOWN DESIGN AND STRUCTURE DIAGRAM:
Example 1:
The complex problem of the smart phone system, is broken down into sub-problem
• A sub system to manage inputs and outputs through touch screen
• A sub system to manage file storage
• A sub-system to manage transmission

Page 1 of 4
This can be represented diagrammatically as structure diagram.

SMARTPHONE

INPUT/OUTPUT FILE HANDLING TRANSMISSION

INPUT OUTPUT WRITE READ INCOMING OUTGOING


DATA DATA

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

HOURS WORKED RATE OF PAY TOTAL

OVERTIME NORMAL OUTPUT


NORMAL OVERTIME
NORMAL PAY +
HOURS * PAY HOURS * (1.5
HOURS HOURS RATE * PAY RATE)
OVERTIME PAY

BENEFITS OF TOP-DOWN DESIGN:


• Different designers can work on modules individually then bring the sun problems together at
the end.
• Once each module has been designed, they can be given to different programmers to code.
These speeds up the development of the program.
• As each module is a shorter program, they are easier to write, test and de-bug than the full
system.

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

See book for examples and description of each type of check


(Note: Check digit is used on data entry and checksum are used for data transmission.)
Example 1: A real estate agent stores data about the properties they sell. Suggest suitable validation
for each data item and justify your choice.

Data Validation checks


Property type Lookup table, presence check
Number of bedrooms Type check
Garden Lookup table
Seller’s family name Type check
Selling price Range check

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.

NORMAL DATA ABNORMAL DATA EXTREME DATA BOUNDARY DATA


Accepted Rejected Accepted Two values: one is
accepted, one is
rejected
No error message Error messages No error message No error message if
accepted, error
message if rejected
Tests that the solution Values not used or Tests that the solution Tests that the solution
works as it should stored works as is should with works as it should with
highest or lowest highest and lowest
values values accepted and
the lowest and highest
values not used or
stored

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

You might also like