The Programming Process:
Developing a program involves steps similar to any problem-solving task. There
are five main ingredients in the programming process:
1. Defining the problem
2. Planning the solution
3. Coding the program
4. Testing the program
5. Documenting the program
The following four steps are crucial to take when designing any program:
1. Identify the problem: What problem does your program solve? If you can’t
clearly state what your program does, you won’t know how to design it.
2. Identify the user: Who’s going to use your program?
3. Determine the target computer: Which computer do people need to run your
program? Is it a Windows computer, a Macintosh, a mainframe, a computer
running Linux, a handheld Palm or Pocket PC, or a supercomputer?
4. Determine your programming skill: Are you going to write the entire thing
yourself or get help from others? If you’re going to get others to help you, which
parts of the program are they going to write?
In the Basic Programming process, We should consider the following Phases / Levels
I. Writing the Algorithms:
II. Designing the Flow Charts:
III. Developing the Programs:
I. Algorithm:
Definition:
“A process t h a t r e f e r s s et of rules / instructions through step-by-step to
be followed in calculations or other problem- solving operations in order to
get the expected results”.
Algorithm is a step-by-step procedure, which defines a set of instructions to be
executed in a certain order to get the desired output. Algorithms are generally created
independent of underlying languages, i.e. an algorithm can be implemented in more than
one programming language.
From the data structure point of view, following are some important categories of algorithms −
Search − Algorithm to search an item in a data structure.
Sort − Algorithm to sort items in a certain order.
Insert − Algorithm to insert item in a data structure.
Update − Algorithm to update an existing item in a data structure.
Delete − Algorithm to delete an existing item from a data structure.
Characteristics of an Algorithm:
An algorithm should have the following characteristics −
1. Unambiguous − Algorithm should be clear and unambiguous. Each
of its steps (phases), and their inputs/outputs should be clear and must
lead to only one meaning.
2. Input − An algorithm should have 0 or more well-defined inputs.
3. Output − An algorithm should have 1 or more well-defined
outputs, and should match the desired output.
4. Finiteness − Algorithms must terminate after a finite number of steps.
5. Feasibility − Should be feasible with the available resources.
6. Independent − An algorithm should have step-by-step directions,
which should be independent of any programming code.
Advantages of Algorithms:
It is easy to understand.
Algorithm is a step-wise representation of a solution to a given problem.
In Algorithm the problem is broken down into smaller pieces or steps hence,
it is easier for the programmer to convert it into an actual program.
Disadvantages of Algorithms:
Writing an algorithm takes a long time so it is time-consuming.
Branching and Looping statements are difficult to show in Algorithms.
Pre-Requisites of an Algorithm:
In order to write an algorithm, following things are needed as a pre-requisite:
1. The problem that is to be solved by this algorithm.
2. The constraints of the problem that must be considered while solving
the problem.
3. The inputs to be taken to solve the problem.
4. The outputs to be expected when the problem the is solved.
5. The solution to this problem, in the given constraints.
Example1:
Problem − Design an algorithm to add two numbers and display the result.
Step 1 − Start
Step 2 − declare three integers
a, b and c
Step 3 – define/Read values of
a&b
Step 4 – Calculate c as a+b
Step 5 – Display/Write c
value
Step 6– Stop
Example2:
Problem − Design an algorithm to find biggest among three numbers.
Step 1 − Start
Step 2 − declare three integers
a, b and c
Step 3 – define/Read values of
a, b and c
Step 4 – Check (a>=b && a>=c)
Step 4.1- Display ‘a’ as biggest
number
Step 5 – Check (b>=c && b>=a)
Step 5.1- Display ‘b’ as biggest
number
Step 6 – Check (c>=a && c>=b)
Step 6.1- Display ‘c’ as biggest
number
Step 7– Stop