0% found this document useful (0 votes)
21 views5 pages

Programming Concepts

A step to becoming a programmer. my teacher gave me this book and it helped me , l hope it helps you

Uploaded by

ruer0033
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
21 views5 pages

Programming Concepts

A step to becoming a programmer. my teacher gave me this book and it helped me , l hope it helps you

Uploaded by

ruer0033
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

mlamboevans1@gmail.

com 0785187880

PROGRAMMING CONCEPTS
Definition of terms:
 Program: a set of detailed and unambiguous instructions that instructs a computer to
perform a specific task, for example, to add a set of numbers.

 Programming: A process of designing, coding and testing computer programs.

 Programmer: A person who specializes in designing, coding and testing computer


programs

 Problem: any question or matter involving difficulty or uncertainty and is proposed for
solution.

Programming Languages

 A programming language is a set of symbols in computer language that are used in coding
computer programs.
 A programming language is a specially written code used for writing application programs
e.g C, Pascal, COBOL, VISUAL BASIC, C++ and Java.

Programming languages are of the following types:

1. Low Level Languages (LLL):


 These are programming languages used to write programs in machine code that is
in zeros and ones or in mnemonic codes. Low level language is in two forms:

Machine Language and Assembly Language.

 Machine Code (Language) is the language used to write programs in binary form (zeros
and ones).

Machine language has the following advantages:

 Programs run faster since they are already in computer language.


 There is no need for conversion as programs are in machine language.
 Programs occupy very small disc storage space by storing just 1s and 0s.

Disadvantages of Machine Language:


 They are very difficult to learn.
 They are difficult to understand.
 Very difficult to use and takes too long to find an error in a program.
 It takes too long to develop working programs.
 They are machine dependent (they can only work on type of computer designed for and not work
on other computers)
mlamboevans1@gmail.com 0785187880

Assembly Language:

These are programming languages that use mnemonic codes in coding programs. Mnemonic codes
are abbreviations used in coding assembly language programs, for example, LDA for Load, ADD
for Addition, etc. Mnemonic codes are very close to machine code, hence are low level language
assembly language codes

Advantages of Assembly language:


 One assembly language instruction corresponds to one machine code instruction and therefore
translation is easier and faster.
 Programs run faster since they are close to machine code.
 They occupy very small disk storage space hence are economical to use.
 Easier for a programmer to use than machine language.

Disadvantages of Assembly Language


 They are very difficult to learn.
 They are very difficult to understand.
 Takes too long to develop working programs.
 They can be machine dependent.

High Level Languages (HLL):

 These are programming languages that use English like statements in coding programs, for
example COBOL, Pascal, BASIC, etc.
 There are so many high level languages because each language is designed for a specific
problem to be solved in our daily lives. For example BASIC was designed for learning
purposes, COBOL for business applications, FORTRAN for scientific purposes, etc. Below
is an example of a BASIC program that accepts two numbers entered through the
keyboard, adds them and display the result on the screen:

START
INPUT “ENTER FIRST NUMBER.”, A
INPUT “ENTER SECOND NUMBER.”, B
SUM = A + B
PRINT SUM
END

Programs written in High Level Language are first converted to machine code before running.

Advantages of High Level Languages:


 They are easier to understand since they are written in English-like statements which are more
readable.
 They are easier to learn.
 It is easier to work with, that is to correct errors and to test programs.
mlamboevans1@gmail.com 0785187880

 They are problem oriented and therefore can be used on any computer (not
machine dependent)

Disadvantages of HLL
 Takes long to run since they need to be first converted to machine code.
 They occupy a lot of disk storage space as compared to low level languages.

Factors to consider when choosing a programming language


 Nature of the application.
 Availability of needed facilities in the programming language for system implementation.
 Availability of compatible hardware.
 Availability of expertise of the programmers.

Translators
These are programs used to convert source code into machine code, and are in three types, which
are interpreters, compilers and assemblers, which are further explained below:

1. Interpreters
These are programs that convert (translate) and run one instruction of a program at a time before
going to the next, until the end of the program, e.g. the BASIC interpreter. They do not produce
the machine code version of a program; hence conversion is repeated when you run the program
again. Thus interpreters retain source code. The interpreter must be present in the computer for the
program to run.

Functions of Interpreters
 They check syntax error in a program statement.
 They translate an instruction into machine language and run it before going to the next.
 Allocates storage space to variables.

Advantages of interpreters
 It is easy to find and correct syntax errors in interpreted programs.
 It is very fast to run programs for the first time.
 It is very fast to run small programs.
Disadvantages of interpreters
 They are very slow in running very large programs.
 They do not produce an object code of a source code and hence difficult to use.
 The interpreter must be present in the computer for the program to run.

2. Compilers
These are programs that convert a high level language program into its machine code equivalent at
one go and then run it, e.g. the COBOL compiler. Thus it translates the entire program before
running it. Once compiled, the program no longer needs conversion since the machine code
version is the one that will be run, until some changes are made to the program code. Thus a
compiler produces an object code of the program. The computer must have a compiler for
translation.
mlamboevans1@gmail.com 0785187880

Functions of Compilers
 They check syntax errors in program statements.
 They allocate storage space to variables.
 Translate the whole program into machine code at one go.
 Run an object code of the program.
 Produces a program listing which indicates position of errors in a program.

Advantages of Compilers
 Compiled programs runs faster since the object code is run.
 Compilers indicate the line numbers with syntax errors and therefore assist programmers in
debugging programs.
 They are appropriate even for very large programs.

Disadvantages of Compilers
 Slower than interpreters for running programs for the first time.
 The compiler must be present for the translation process to occur.
 They can cause the computer to crash.
 Difficult to find errors in compiled program.

*NB: Source Code refers to the program written in English-like statements (High Level
Language) by the programmer.

Object Code refers to a machine code version of a source code. All programs written in source
code must be converted to object code for the computer to understand them.

3. Assemblers: These are programs used to convert assembly language instructions into machine
language. Other uses of assemblers include:
 They generate machine code that is equivalent to assembly language.
 They are used to check the validity of instructions, that is, checking for syntax errors in an
instruction.
 They also assign memory locations to variables.

Difference between High Level Languages and Low Level Languages


mlamboevans1@gmail.com 0785187880

Top-Down Program Design


Refers to the splitting of a program into simpler subtasks called modules which will be easier to
solve. For example, a program can be split into modules to Accept Number, Add, Divide, Subtract
and to Display Results. Modules are also called procedures, routines, sub-routines or functions.
The splitting of a problem into a series of self-contained modules is called modularisation
(modular programming).

Advantages of modularisation (modular programming)


 Programmer can concentrate at one task at a time.
 Modules are simpler and easier to understand and to solve.
 Modules are easier to test and to debug.
 Program modification is easier since changes are isolated with specific modules.
 More experienced programmers can be assigned complex modules.
 It saves programming time by sharing tasks.
 A large project will be easier to monitor. It is easier to update (modify) modules

Disadvantage of modularisation
 It may be difficult to link the modules together.
 There could be problems of usage of variables as similar variable names may be referring
to different sets of data.
 They may also vary in scope.

NB: Library programs: this refers to a collection of standard programs and subroutines that are
stored and available for immediate use by other modules in the system. Library programs are
referenced by most modules in the systems.

NB Stepwise refinement: a technique used in developing a system by breaking it into modules


and then work on the internal working of a module.

NB: The difference between a procedure and a function is that a procedure is a sub program that
do not return a value while a function is a sub-program that returns a value.

You might also like