Design thinking is an iterative problem-solving process of discovery, employs various techniques to gain insight and produce innovative solutions for any type of challenge (academic or non-academic (organizational or business)).
2. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Learning Objectives
In this topic we will
learn about:
• computer systems
and sub-systems
• top-down design
• structure
diagrams
• flowcharts
• pseudocode
• library routines
• sub-routines
• algorithms
• standard methods
of solution
• test data
• validation and
verification
• using trace tables
• identifying and
correcting errors
• producing
algorithms
• the effectiveness
of a solution.
3. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Introduction
• In order to build a computer system that performs a
specific task or solves a given problem, the task or
problem has to be clearly defined, showing what is
going to be computed and how it is going to be
computed.
• This topic introduces the tools and techniques that
are used to design a software solution that together
with the associated computer hardware will form a
computer system.
5. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is a computer system?
• A computer system consists of software, data, hardware,
communications and people that have been carefully chosen so
that they work well together in order to build a computer system
that performs a specific task.
• HOT
• Do we have a system other than computer systems?
• Why we use system?
6. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What tools and techniques are used to
develop a system?
• Computer system is often divided up into sub-systems.
1. This division can be shown using top-down design to produce
structure diagrams that demonstrate the modular construction
of the system.
2. Each sub-system can be developed by a programmer as sub-
routine or an existing library routine may be already available
for use.
3. How each sub-routine works can be shown by using flowcharts or
pseudocode.
7. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Top-down design
• It is the breaking down of a computer system into a set of
subsystems, then breaking each sub-system down into a set of
smaller sub-systems, until each sub-system just performs a single
action.
• This is an effective way of designing a computer system to provide
a solution to a problem, since each part of the problem is broken
down into smaller more manageable problems.
• The process of breaking down into smaller sub-systems is called
‘Stepwise Refinement’.
8. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Structure diagrams
• The STRUCTURE 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-
systems.
9. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Real-life application
• Alarm app for a smart phone
• Consider the alarm app computer system for a smart phone.
• Creating the solution This involves:
1. top-down design or stepwise refinement
2. algorithms, which can be represented as
a. program flowcharts
b. pseudocode
• Using top-down design approach, this could be divided into three sub-systems,
• setting the alarm,
• checking for the alarm time,
• sounding the alarm.
• These sub-systems could then be further sub-divided; the structure diagram
makes the process clearer.
11. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Activity
1. A school wants to calculate the number of hours spent in school
by a sample of students from time of arrival and departure data.
Draw a structure diagram and a program flowchart for an
algorithm with the following features:
2. Draw a structure diagram for cleaning your teeth.
12. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Solution
• Calculating hours spent in
school
• Using top-down design approach,
this system could be divided into
three sub-systems,
• For each student, enter the
student’s name, the time of arrival
and the time of departure.
• Calculate the length of time each
student spends in school.
• Output the student’s name and the
time spent in school.
13. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Flowcharts?
• A flowchart is a type of diagram that represents an algorithm,
workflow or process, showing the steps as boxes of various kinds,
and their order by connecting them with arrows. This
diagrammatic representation illustrates a solution model to a
given problem. OR
• A FLOWCHART shows diagrammatically the steps required for a
task (sub-system) and the order that they are to be performed.
These steps together with the order are called an ALGORITHM.
• Flowcharts are an effective way to communicate the algorithm
that shows how a system or sub-system works.
15. Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Pair Activity
• Write a flowchart program which input two numbers and output
the sum of these number
• Write a flowchart program to input physics and English marks and
output the total marks
16. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Critical Thinking - Pair Work
1. Write an algorithm in the form of a flowchart which takes
temperatures input over a 100 day period (once per day) and
outputs the number of days when the temperature was below
20C and the number of days when the temperature was 20C
and above.
2. Write an algorithm in the form of a flowchart which:
• inputs the top speeds (in km/hr) of 5000 cars
• outputs the fastest speed and the slowest speed
• outputs the average (mean) speed of all the 5000 cars
18. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is an algorithm?
• An algorithm is a self-contained sequence of
actions to be performed to solve a problem.
• Well-structured programs require a programming
language to support the following program
constructs:
• sequence
• selection
• iteration
19. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is pseudocode?
• Pseudocode is an informal high-level description
of the operating principle of a computer program
or other algorithm. It uses the structural
conventions of a normal programming language,
but is intended for human reading rather than
machine reading.
20. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Understand and use pseudocode
• understand and use pseudocode for assignment, using ←
• understand and use pseudocode, using the following
commands and statements:
• INPUT and OUTPUT (e.g. READ and PRINT)
• totaling (e.g. Sum ← Sum + Number)
• counting (e.g. Count ← Count + 1)
21. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Understand and use pseudocode / algorithm
• understand and use pseudocode, using the following conditional
statements:
• IF … THEN … ELSE … ENDIF
• CASE … OF … OTHERWISE … ENDCASE
• understand and use pseudocode, using the following loop
structures:
• FOR … TO … NEXT
• REPEAT … UNTIL
• WHILE … DO … ENDWHILE
• (Candidates are advised to try out solutions to a variety of different
problems on a computer using a language of their choice; no
particular programming language will be assumed in this syllabus.)
22. Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Algorithm Vs Pseudocode Vs Program
• An algorithm is a well-defined procedure that allows a
computer to solve a problem.
• Pseudocode is a simple way of writing programming
code in simple language like English.
• A program is a sequence of instructions in a particular
programming language for instance QBASIC or C++,
written to perform a specified task on a computer.
23. Sir Z@h!d Al!
+971-568047507
+92-3242415561
HOTS - Pair Activity
•Write a algorithm program which input
two numbers and output the sum of
these number
•Write a algorithm program to input
physics and English marks and output
the total marks
24. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Critical Thinking - Pair Work
1. Write an algorithm in the form of a pseudocode / flowchart
which takes temperatures input over a 100 day period (once
per day) and outputs the number of days when the
temperature was below 20C and the number of days when the
temperature was 20C and above.
2. Write an algorithm in the form of a pseudocode / flowchart
which:
• inputs the top speeds (in km/hr) of 5000 cars
• outputs the fastest speed and the slowest speed
• outputs the average (mean) speed of all the 5000 cars
25. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Library routines?
• A LIBRARY ROUTINE 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, the task „get time‟ in the checking-
for-the-alarm time algorithm would probably be
readily available as a library routine.
26. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Sub-routines?
•A SUB-ROUTINE is a set of programming
instructions for a given task that forms a
subsystem, not the whole system.
•Sub-routines written in high-level
programming languages are called
„procedures‟ or „functions‟ depending on
how they are used.
27. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Test Data? Why it is important ?
• Test data is the data that is used in tests of a program or system.
• In order to test a program we need to enter some data for testing
most of the features. Any such specifically identified data which
is used in tests is known as test data.
• There are following three types of test data:
• 1. Normal Data
• 2. Extreme Data
• 3. Abnormal Data
28. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Difference between Normal, Extreme and
Abnormal Data
Test Case Explanation
Example where a
score should be
between 0 and 50
Normal
Data that you would expect to work
or be accepted and that lies within
the range
2, 45
Extreme
Data at the lower and upper limits of
the range
0, 50
Abnormal
Data that should not be accepted by
the program
-7, 51, Ahmed
29. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Rogue Values?
• A value of input which is used to halt / break to
repetitive statement. OR
• A sequence of inputs may continue until a
specific value is arrived / input. This value is
called a rogue value and must be a value which
would not normally arise.
• A rogue value lets the computer know that a
sequence of input values has come to an end.
30. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Pair Work Activity
• A number of marks are to be input (terminated by a rogue value of
-1). How many of them are over 50?
• Counter = 0
• INPUT Marks
• REPEAT
• IF Marks >50 THEN counter = counter +1
• INPUT Marks
• UNTIL Marks=-1
• OUTPUT counter
31. Sir Z@h!d Al!
+971-568047507
+92-3242415561
How readable is your code?
• Often programmers will work on each other's code. So you need to
write your code so that it can be read and understood by others.
You also need to be able to understand it if you come back to it
months or years later. There are a few techniques you can use to
help with this:
• Internal commentary
• Meaningful identifiers (variable names)
• Indentation
• White Space
33. Sir Z@h!d Al!
+971-568047507
+92-3242415561
How to make sure that there is no error in
the data?
• Data verification and data validation are two
methods of making sure no errors occur in the
data before processing takes place. (Make sure
you know the difference between them!)
34. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Data Verification?
• Typing data into a computer from a data capture form is called
transcribing. If an error is made it is a transcription error.
• Verification is done to eliminate transcription errors.
• Methods of verification...
Proof
reading
A visual check by eye that no errors have been made. This is
sometimes done by printing out data that has been input, and
sending it back to the source of the data to check. For example,
printed proofs of the pages of a book may be sent back to the author
for checking.
Double-
keying
This is a check to see if data has been keyed in correctly. The data is
keyed in twice, and the computer will only accept the data for
processing if the two versions are identical.
35. Sir Z@h!d Al!
+971-568047507
+92-3242415561
What is Validation?
• Validation is the automated checking by a program
that data is reasonable before it is accepted into a
computer system. Different types of check may be
used on the same piece of data;
• A check to see if data is 'valid' before it is processed
that it is sensible data.
• There are a number of different data validation
checks which can be carried out. Following are some
of them:
36. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Types of Validations
Validation type How it works Example usage
Check digit the last one or two digits in a code are
used to check the other digits are
correct
bar code readers in supermarkets use check
digits
Format check checks the data is in the right format a National Insurance number is in the form LL
99 99 99 L where L is any letter and 9 is any
number
Length check checks the data isn't too short or too
long
a password which needs to be eight letters
long
Lookup table looks up acceptable values in a table there are only seven possible days of the week
Presence check checks that data has been entered into
a field
in most databases a key fieldcannot be left
blank
Range check checks that a value falls within the
specified range
number of hours worked must be less than 50
and more than 0
Spell check looks up words in a dictionary when word processing
37. Sir Z@h!d Al!
+971-568047507
+92-3242415561
Challenge!!! Individual work
• Write an pseudocode for range check.
• Draw the flow chart for the range check.
• Write an pseudocode for presence check.
• Draw the flow chart for the presence check.
• Write an pseudocode for length check.
• Draw the flow chart for the length check.
• Try same for other varification and validation checks like double
keying etc.