0% found this document useful (0 votes)
5 views14 pages

Programming and System Analysis and Design F3 & 4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views14 pages

Programming and System Analysis and Design F3 & 4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 14

6.

8 PROGRAMMING

Generations of programming
language
Qn. Identify and explain the
generations of computer
programming languages.
First generation

Low Level languages such as assembly language and machine code are first generation
languages.

They are executed directly without translation.

Machine code is the actual pattern of 0s and 1s used in computer memory.

Programs written in machine code are time consuming, laborious and error prone when
entering into the computer.

Second generation

Assembly code is second generation languages.

They allow programmers to use mnemonics (abbreviations that represent an instruction


in a memorable way) and denary numbers (1-9) instead of 0s and 1s.

E.g. ADD or ADX to add two numbers, SUB or SBX an instruction to subtract.
Programs written in assembly language need to be translated into machine code before
execution.

The program called Assembler is used to do the translation.

Third generation

Imperative high level languages such as Pascal, COBOL, FORTRAN, BASIC and Algol are
third generation languages.

It is a refinement of the second generation language that makes the language more
programmers friendly.

It includes features like data types and expressing concepts in a way that favours the
programmer not the computer.

Fourth generation

They are languages with the all powerful commands like SQL.

They use command such as SORT which are easier than writing your own sort
procedures using third generation languages.

Fifth generation

Are languages like Prolog.

They are often regarded as very high level languages.

Experts systems are often written in Prolog.

They based on solving problems using constraints given to the program rather using an
algorithm written by a programmer.

Are mostly used in artificial intelligence.


Programming languages

Qn. Identify and describe


computer programming
languages.
Qn. Outline the strengths and
shortfalls of each and every
computer
programming language.
They can be divided into two types:

These are:

Low Level Languages: which are closer to machine language

High Level Languages: which are closer to human language.

Low Level Languages:


It is a language of a particular processor.

It is the code for a particular machine (computer) and is given the name machine code.

They are machine oriented because they refer to hardware such as processor’s register,
input and output ports and specific locations in internal memory.
Advantages

Skilful programmer has complete freedom of the choice of instructions.

Programmers have direct control over the processor’s communication with its
peripherals.

The programmers can write very efficient programs that:

Fits into limited storage space

Require limited RAM.

Run rapidly

Disadvantages

They are difficult for a programmer to read since they lack human relationship.

They are machine oriented making them hard to learn for the programmer.

Programs written in low level language are not portable that means they are not
transferable between families of processors.

Machine language

It consists of a string of zeros and ones and because of this is the lowest level of
language.

It is difficult for programmers to read and write.

Programs written in machine language can be converted to machine code without using
a compiler or interpreter.

Machine language instruction consists of an operation code known as an ‘opcode’.

Example of an opcode 110000.

Assembly language.

It is a low level language for a computer or other programmable device.

It is developed for a family of processors.

Assembly language is considerably easier to read or write than machine language.

It consists of mnemonic- a short word or abbreviation that acts as a memory aid.


Example of instruction in the PIC16F627 microcontroller’s assembly language is:
MOVLW 0x5A.

It need to be converted into executed machine code by a program called assembler.

The conversion processing is referred o as assembly, or assembly the code.

High level languages


They are similar to human language or mathematical notations.

They are easy to read and write, test debug and maintain.

They are problem oriented rather than machine oriented.

Different languages are designed to solve different types of problems.

They are independence of the instruction set of any particular family of processor.

Types of high level programming languages

Language Use

COBOL (Common Business Oriented Business application


Language)

FOTRAN (FORmula TRANslation) Scientific applications

General purpose and educational use

BASIC (Beginners All-purpose Symbolic

Instruction Code)

Visual BASIC

Pascal

Delphi

LISP

LOGO

C
Language Use

C++

Java

A comparison of translation programs.

Qn. Compare and contrast the


translation programs.

Assembler Compiler Interpreter

Translates processor-specific Translate HLL code into Translate HLL statements


assembly code into machine machine code for specific and executes them on a
code for a specific processor processor and operating specific processor and
system operating system

Translate an entire program Translate an entire program Translate and executes a


but does not run it but does not run it program on the target
processor, usually one
statement at a time, but
does not run it.

Translate one source code Translate one source code Executes one source code
instruction to one machine statement to one or more statement as one of more
machine code instructions. instructions.
code instruction
Comparison of features of LLL and HLL

Qn. Contrast the LLL and HLL.


High Level Languages Low Level Language

Program statements are problem oriented Program instructions are machine oriented

Programs are portable between different Programs are not portable between different
types of computer types of computer.

Programs must be translated to run on a Machine language need no translation


processor

Translation to a machine language is Translation from assembly language to


relatively complex machine language is relatively simple

Programs are relatively easy to read and Programs are relatively hard to read and
write write

Programs are relatively easy to test, debug Programs are relatively hard to test, debug
and maintain and maintain.
Top-Down Program Design

Qn. Define the following terms as used in


computer programming:
(i) Top-down program design or approach
-Refers to the splitting of a program/task/probleminto simpler subtasks called modules which willbe
easier to solve. A complex problem is split into several smaller sub-problems that are easier to tackle.
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.

(ii) Library programs


-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.

(iii) Step-wise refinement


-is defined as a technique used in developing a system by breaking it into modules and then work on the
internal working of a module.

(iv) Modularisation
-is defined as the splitting of a problem into a series of self-contained modules.

Qn. Give the strengths and shortfalls of


Modularisation.
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

However,

Itmay 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.

Qn. Distinguish between a procedure and


function.
- a procedure is a sub-program that do not return a value whilst a functionis a sub-program that returns
a value.

System flowcharts

Qn. Define the term system flowchart.


-refers to a diagram used to show how all the components in a system link together for instance, input,
storage, output and processing.
NB-They are very different to normal flowcharts since they don’t go into detail of how something is
actually done –they are a general overview. It shows the overview of the system, tasks carried out by
the system, whether manual or computer, devices, output media and files used, etc.

Qn. Identify, draw and explain the symbols


used to draw System flowcharts.
Qn. Draw a system flowchart that is used
to update stock master file whem stock
items are purchased.
Structure diagrams
Qn. Define a structure diagram
-refers to the graphical representation that show relationships between different modules as given
below.

Qn. Draw a structure diagram for the the


program to add and multiply 2 numbers.

You might also like