7.
1 Algorithm design & Problem-solving
Objective: Candidates should be able to:
Understand program development life cycle, limited to: analysis, design, coding and testing
Understand computer system is made up of sub-systems, which are made up of further sub-
systems.
Understand how a problem can be decomposed into its component parts.
Use different methods to design and construct a solution to a problem.
Explain purpose of a given algorithm.
Purpose of Program Development Life Cycle
To develop a successful program that is used by others to perform a specific task or
solve a given problem, the development needs to be well ordered and clearly
documented, so that it can be understood and used by other developers.
Stages of Program Development Life Cycle
Program development life cycle is divided into analysis, design, coding and testing.
Analysis P22/O/N/24
In analysis stage, we identify problem and requirements specification of
program. Analysis stage uses abstraction and decomposition tools to identify exactly
what is required from program.
Tasks in analysis stage of program development life cycle. 0478 P22 May 24
1) Abstraction involves filtering out information that is not necessary to solve a problem
and to include only essential information. P21/O/N/23
Benefits of Abstraction:
❖ Time required to develop program is reduced.
❖ Program is smaller in size so takes up less space in memory and download times
are shortened.
2) Decomposition enables programmer to break a complex problem into smaller parts
that can be further subdivided into smaller parts until each part is easy to examine and
understand, and a solution can be developed for it.
Benefit of Decomposition:
❖ Breaking a complex problem down makes it easier to understand.
❖ Smaller problems are easier to program/test/maintain.
❖ Sub-problems can be given to different programmers with different expertise.
3) identification of problem and requirements // outline of success criteria
Design
Program specification from analysis stage is used to show how program
should be developed. When design stage is complete, programmer should know what
is to be done. This can be documented using structure charts, flowcharts and
pseudocode.
Computer Science IGCSE, O & A level By Engr M Kashif 03345606716
7.1 Algorithm design & Problem-solving
Coding
In coding stage, we write code to implement the program to solve
problem. Each module of program is written using a suitable programming language.
Testing
Testing stage is used to detect and fix error in program. Program is run
many times with different sets of test data. This ensures that all tasks completed work
together as specified in program design. Iterative testing means that modular tests
are conducted, code amended, and tests repeated until module performs as required.
Top-down Design
Top-down design is decomposition of a complex problem into a set of sub systems,
then breaking each sub-system down into a set of smaller sub-systems, until each sub-
system just performs a single action.
Process of breaking down into smaller sub-systems is called Stepwise Refinement.
ESQ: Why programmer prefer Top-Down Design while constructing Computer System?
When large computer systems are being developed then several programmers have to work
independently to develop and test different subsystems for the same system at the same
time. This reduces the development and testing time.
ESQ: New software is often developed using top-down (modular) design. Give three benefits
of using this method of development.
Breaking the problem into parts helps us to clarify what needs to be done.
Breaking the problem into parts allows more than one person to work on solution.
Parts of the solution may turn out to be reusable.
Decomposing a Problem
Problem that uses a computer system for its solution needs to be decomposed into its
component parts. Component parts of any computer system are: P21/O/N/23
1. Inputs: Data used by system that needs to be entered while system is active.
2. Processes: Tasks that need to be performed using input data and any other previously
stored data.
3. Outputs: Information that needs to be displayed or printed for users of system.
4. Storage: Data that needs to be stored in files on appropriate medium for use in
future.
Example: Alarm app can be decomposed into:
Inputs: Time to set alarm, remove previously set alarm time, switch an alarm off,
press snooze button.
Processes: Continuously check if current time matches an alarm time that has been
set, storage and removal of alarm times, management of snooze
Computer Science IGCSE, O & A level By Engr M Kashif 03345606716
7.1 Algorithm design & Problem-solving
Outputs: Continuous sound alarm (at alarm time or after snooze time expired)
Storage: Time(s) for alarms set.
Methods
Following methods are used to design and construct a solution to a problem.
Structure diagrams, Flowcharts, Pseudocode,
Structure Diagrams
Structure diagrams is used to show top-down design in a
diagrammatic form. Structure diagrams are hierarchical, showing how a computer
system solution can be divided into sub-systems with each level giving a more detailed
breakdown. If necessary, each sub-system can be further divided.
Alarm App for a Smart Phone
ESQ: A food ordering system is an example of a computer system that is made up of
sub-systems. The food ordering system: 0478/22/F/M/23
• allows the user to enter details of food they want to order and to pay for the order
• displays food available as pictures or as a list.
Complete structure diagram for given parts of food ordering system.
Ans:
Note: We will study flowchart and pseudocode in coming chapter .
****************
Computer Science IGCSE, O & A level By Engr M Kashif 03345606716