You are on page 1of 6

Topic  Introduction to

1 Programming

LEARNING OUTCOMES
By the end of this topic, you should be able to:
1. Define computer program and programming; and
2. List the six steps involved in the program development process.

 INTRODUCTION
Since its introduction, computers have helped tremendously to make everyday
human tasks easier. With the help of a computer, we can pay bills, perform
banking transactions and even shop from home. Businesses depend on
computers for seamless operations. More and more students are also learning
with computers at schools. Imagine a life without computers!

Apart from computers themselves, of equal importance is computer


programming. Programming is a list of instructions followed by a computer.
Without it, a computer will not be able to function. Programming languages
allow us to write these programs and therefore, communicate with the computer.

This topic will discuss programming concepts and the processes involved in
developing a program.

ACTIVITY 1.1

Before we proceed further, state what you know about programming.

Copyright © Open University Malaysia (OUM)


2  TOPIC 1 INTRODUCTION TO PROGRAMMING

1.1 INTRODUCTION AND DEFINITIONS


As we know, human behaviour and thoughts are always based on a logical
sequence. These behaviours and thoughts happen automatically without us
realising them. Let us take a look at one of our daily actions. To turn on the tap,
the following sequence is needed:

(a) Lift hand to hold the tap head; then


(b) Rotate the tap head anti clock-wise (from right to left).

Being aware of the sequence of things is important in human life. The sequence is
achieved through a process called programming. In our daily routine, we often
have to do the same tasks repeatedly. This may make us feel bored or to lose
interest, resulting in the task not being completed properly or completed with
errors. Programs prevent human beings from having to do repetitive tasks.

In the language of programming language, programming is defined as planning,


scheduling and/or performing a task/event. It configures a computer to perform
a particular task or various tasks that is/are required.

Computer programming is a process to plan a set of sequential instructions


to be run by a computer.

Whereas,

A computer program, is a sequential instruction which determines the steps


to be taken by a computer.

1.2 PROGRAM DEVELOPMENT PROCESS


To simplify program development, we can divide the programming process into
two phases:

(a) The problem-solving phase; and


(b) The implementation phase.

Copyright © Open University Malaysia (OUM)


TOPIC 1 INTRODUCTION TO PROGRAMMING  3

Each of these phases is divided into several parts. Refer to Figure 1.1 to learn
about the relationship between these two phases.

Figure 1.1: Programming process

Now, let us look at the two phases in detail.

1.2.1 Problem-solving Phase


There are three steps that must be taken to solve any problem, which are:

(a) To perform a problem analysis;


(b) Get a general algorithm design; and
(c) Walkthrough the algorithm.

We will discuss in detail how these three steps are carried out.

Copyright © Open University Malaysia (OUM)


4  TOPIC 1 INTRODUCTION TO PROGRAMMING

(a) Analysis
Analysis is the process of understanding and defining a problem. At this
stage, a programmer should try to state the problem clearly and
understand what needs to be done to solve the problem. We may need to
know additional detailed information from the people who have identified
the problem.

During analysis, ensure that you understand and define the problem
accurately.

(b) General Design (Algorithm)


Algorithm is a set of logical sequential steps used to solve a problem.

The process of creating an algorithm is called the problem-solving design


process. Normally, writing an algorithm is the most challenging part in the
problem-solving process.

Most computer algorithms have at least three sub-problems, as stated


below:
(i) Data collection;
(ii) Process calculations; and
(iii) Output results.

Once the sub-problem is identified, we can solve each sub-problem, one at


a time.

(c) Walkthrough
Walkthrough is one of the steps in algorithm design that is often forgotten.

To walkthrough an algorithm, we must perform each step of the algorithm


just as it would be done by the computer, to see if the algorithm really does
solve the problem. This process is called tracing the algorithm. To perform
this step, we must create an input sample for the algorithm and check it
step by step. This is the time to find errors and to correct them.

Copyright © Open University Malaysia (OUM)


TOPIC 1 INTRODUCTION TO PROGRAMMING  5

1.2.2 Implementation Phase


The implementation phase also consists of three steps which are:

 Detailed problem-solving in the form of program code;

 Carrying out tests on the program code; and

 Maintaining the program code.

(a) Detailed Design (Program Code)


The algorithm implementation process involves writing a program code.
We need to interpret each algorithm step into one or more statements in
programming language.

(b) Testing
Testing a program code is the process of running a program and checking it
for errors. This is to ensure the program does what it is intended to do.
Normally, testing is carried out by running the program code repeatedly
using a set of different data, to ensure it functions properly for every
situation. Large input size that cannot be tested manually has to be tested
now. If an error is found, the program needs to be modified until it
produces the right output or answer.

(c) Maintenance
Maintaining and updating a program code involves tasks in modifying the
program code, to eliminate errors that were not found before, and to
update it according to current changes in the organisationÊs rules and
policies.

Usually, maintenance work is carried out every five years and the
programmer who developed the program might have left the organisation
by then. Therefore, it is important for a programmer to write programs that
are easy to read, understand and maintain. Thus, we must adhere to
programming styles that are accepted by the programming society.

We have so far discussed all the processes involved in the problem-solving


phase as well as the implementation phase. If there are still points you find
unclear, you may wish to go through the text again.

To check your understanding, answer the following questions.

Copyright © Open University Malaysia (OUM)


6  TOPIC 1 INTRODUCTION TO PROGRAMMING

SELF-CHECK 1.1

1. What is a program?

2. At which phase is the algorithm created?

3. At which phase is the written algorithm translated into a


computer program?

4. The programming process is divided into two. State the processes


that are involved in each.

 Computer programming is a process to plan a set of sequential instructions


to be run by a computer.

 A computer program is a sequential instruction which determines the steps


to be taken by a computer.

 To simplify program development, we can divide the programming process


into two phases: the problem-solving phase and the implementation phase.

 There are three steps that must be taken to solve any problem, which are: to
perform a problem analysis, get a general algorithm design and
walkthrough the algorithm.

 The implementation phase also consists of three steps which are: detailed
problem-solving in the form of program code, carrying out tests on the
program code and maintaining the program code.

Algorithm Computer programming


Computer program Walkthrough

Copyright © Open University Malaysia (OUM)

You might also like