You are on page 1of 16

2.

1 Algorithm design and problem-solving


2.1.1 Problem-solving and design

Systems and Sub-systems


• What is a System?

Natural Systems
E.g. ecosystems, weather, water cycle, the human body,

Abstract Systems
E.g. set of mathematical equations, computer programs,…

Designed Systems
E.g. cars, planes, buildings, freeways, telephones, the internet,…

Information Systems
Special case of designed systems - Part of the design includes the representation of the current
state of some human activity system
E.g. MIS, banking systems, databases, …
Elements of a system
• Boundary
Separates a system from its environment
Often not sharply defined
Also known as an “interface”

• Environment
Part of the world with which the system can interact
System and environment are interrelated

• Observable Interactions
How the system interacts with its environment
E.g. inputs and outputs

• Subsystems
Can decompose a system into parts
Each part is also a system
For each subsystem, the remainder of the system is its environment
Subsystems are inter-dependent

• Control Mechanism
How the behaviour of the system is regulated to allow it to endure
Often a natural mechanism
• What is a Computer System?
• Computer system is often divided up into sub-systems.
• This division can be shown using top-down design to produce
structure diagrams that demonstrate the modular construction of the
system.
• Each sub-system can be developed by a programmer as sub-routine or
an existing library routine may be already available for use.
• How each sub-routine works can be shown by using flowcharts or
pseudocodes
• When designing a computer system, it is referred to the system as a
complex problem.
• The sub-systems within a system are referred to as sub-problems.
Top-Down Design
• Top-down Design is the breaking down of a computer system 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.

• 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 a system into smaller sub-systems is called as ‘stepwise
refinement’.
• It is a design method that involved taking a complex problem and break it down
into smaller sub-problems. These sub-problems can often be broken down into
even smaller sub-problems. This process is known as decomposition.
Eg1
Eg2
Eg3
Eg3
Top-Down Design – A design process where an overall task is
broken down into smaller task.
Decomposition – The process of breaking down a large task
into smaller tasks.
Main
Problem System

A B C Sub-Problems
(Sub systems)

Module – simplest
part of the system

Module – An individual section of code that can be used by other programs.


• If you look at the system as a complex problem, it may seem
impossible to solve because its too complicated to handle.
• Eg. Developing a Banking System.
Developing a Taxation System
Developing a Reservation System

• Complex problems can be solved using Top-down Design, also known


as ‘Stepwise Refinement’ where
 Breaking the system into parts
 Breaking the parts into sub-parts
 Soon each sub-parts will be divided to modules
 “Module” - is the smallest element to develop a program
Benefits of using Top-down Design
1. Breaking the problem into parts and sub-parts will help the software
development team to clarify what needs to be done.
2. Algorithms can be developed quickly as more than one person can work
to solve the problem.
- Different designers can work on modules individually then bring the sub-
problems to together at the end.
- Once each module has been designed, they can be given to different
programmers to code. This speeds up the development of the program.
- Each programmer can be given a module that is suitable for their area of
expertise.
Eg. Expert interface design can be given interface module.
Expert in file-handling can be given database module.
- As each module is short it is easier to write, test and debug the
program than the full system.

3. The structure diagram shows, how different modules relate to each


other. This can be important in helping to visualize how a program works.

4. Modules can be reused in different programs that require the same


structure.

5. Structure diagrams make it easier for another designer to understand


the logic of an algorithm.
 Stepwise refinement: design a problem solution by
1. stating the solution at a high level
2. refining steps of the solution into simpler steps
3. repeating step 2, until steps are simple enough to execute
 
 Decompose based on function of each step

Application to Module Design


 Same technique can be used to decompose a system into modules
1.Begin with main module
2. Break a module into submodules
3. Repeat step 2 until modules are small and easily written
4. Use stepwise refinement on individual modules

You might also like