PLANNING A COMPUTER PROGRAM
Planning a computer program means planning the logic of a
program. In order to produce a correct and effective computer
program, the logic of the program must be planned first. Without
the logic, we can’t write the program well.
While writing a computer program, all the instructions must be written in a
proper sequence. When the order is not correct or some of the
instructions are left out, the computer will calculate a wrong
answer. To ensure the correct order and the appropriateness of the
computer instructions, a program must be planned first. Planning a
computer program is done with the help of planning tools and
techniques, which include Algorithm, Flowchart and Pseudo code.
A sequence of instructions is called an
algorithm.
Writing good algorithms is a fundamental part of programming. There are two
commonly used tools available for documenting the program logic (algorithm). They are: flowcharts and
Pseudocode.
Generally, flowcharts work well for small problems but Pseudocode is
used for larger problems.
Have a presentation on problem solving using Computers here:
Have a presentation on problem solving using Computers here:
Writing Algorithm:
The term algorithm refers to the logic of the program. An algorithm
is defined as a step-by-step description of how to arrive at the
solution of a given problem. An algorithm contains a set of
instructions that must be executed in a specified sequence to produce the desired result.
The characteristics of a good algorithm are listed below:
The characteristics of a good algorithm are listed below:
- Each and every instruction should be precise and unambiguous.
- Each instruction should be designed in such a way that it can be performed in a finite time.
- Not a single instruction should be repeated infinitely, i.e., there should be an end for an algorithm both logically and physically.
- After the termination of an execution, the user must be able to get the desired output.
The following are three different ways in which an algorithm can be
represented:
- As Programs
- As Flowcharts
- As Pseudo codes
The first one is the language representation of an algorithm. A program can
be compiled and executed by a computer to produce an expected output.
When a high-level language is used for representing an algorithm, it
becomes a computer program. The syntax and semantics of the
particular programming language must be followed to write the program
in it.
Normally algorithms are written in simple and plain English. No
rules and regulations are formed for writing algorithms except some
characteristics, which qualify a set of instructions to be an
algorithm. To represent algorithms pictorially flowcharts are
used.
Designing Flowcharts:
A flowchart is a pictorial representation of an algorithm.
Programmers often use it as a visual tool for organizing the sequence
of steps necessary to solve a problem. It can be considered as pictorial representation of a
program. The process of drawing a
flowchart for an algorithm is often referred to as flowcharting. Flowcharting is a task that must be done after writing the algorithm
for a computer program.
A set of symbols is provided for drawing flowcharts that represent
different operations to be done by a computer. The symbols used
in a flowchart are connected together using arrow headed solid lines
to indicate the sequence in which the instructions must be evaluated. Some of the common symbols used in
flowcharts are shown below:
With flowcharting, essential steps of an
algorithm are shown using the shapes above. The flow of data between
steps is indicated by arrows, or flowlines.