Cambridge IGCSE & O Level Computer Science Programming Book for Microsoft Visual Basic Sample

Page 36

We are working with Cambridge Assessment International Education towards endorsement of this title. Any references or material related to answers, grades, papers or examinations are based on the opinion of the author(s). CAMBRIDGE IGCSE™ & O LEVEL COMPUTER SCIENCE: PROGRAMMING BOOK

2.2 Design tools When you design programs, it is normal to plan the logic of the program before you start to code the solution. This is an important step in the design of effective systems because a flaw in the logic will often result in programs that run but produce unexpected outputs.

The next stage is to design an algorithm for the individual problems. Two approaches (shown in Table 2.2) that can be used at this stage to help create logically accurate systems are flowcharts and pseudocode. Flowcharts

A graphical representation of the intended logic and sequence of a program or ‘flow of a program’ (which is where the name ‘flowchart’ came from). It is a diagram that describes the flow that the execution of code will take through a program.

Table 2.2: Algorithm design tools

P

Pseudocode A method of describing the logic and sequence of a program using natural language to explain each step in the intended process. The logic can be understood by programmers without the need for detailed knowledge of any specific programming language. The term ‘pseudo’ is derived from the early Greek word for ‘false’.

M

For this course, you will be expected to have a working understanding of both flowcharts and pseudocode and to use them to answer questions that ask you to explain the logic of your solutions to given tasks. Both methods are used throughout this book to indicate the logic of systems, and it is important that you become familiar with their use.

2.3 Flowcharts

A

Flowcharts are graphical representations of the logic of the intended system. They make use of symbols to represent operations or processes which are joined by lines that indicate the sequence of operations. Table 2.3 details the symbols used. Symbol

S

Terminator

Input or output

KEY WORDS top-down design: a way of designing a computer program by breaking down the problem into smaller problems (subsystems) until it is sufficiently defined to allow it to be understood and programmed.

LE

The first step in the design process is to break down the problem into smaller problems. This is called top-down design. Once you have the smaller problems defined then you can consider each problem separately. This will be easier to plan and finally code. You can use a structure diagram to help organise the top-down design. Chapter 6 explains top-down design and structure diagrams.

Notes

algorithm: a process or set of rules to be followed during the execution of a program.

KEY WORD flowchart: a graphical representation of the sequence and logic of a program.

Examples

The START or STOP of a system.

A required INPUT from the system user or an OUTPUT to the system user. The value being input or output is written on the symbol.

START

STOP

INPUT number

OUTPUT result

(continued)

24 Original material © Cambridge University Press 2021. This material is not final and is subject to further changes prior to publication.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.