WK2 Lesson1
WK2 Lesson1
Presentation by
MANZA JOSHUA KIILU
OBJECTIVES
By the end of the lesson the trainee should
be able to:
Explain meaning of structured programming
Identify different types of structured
programming languages
Explain the historical development of
programming languages
zn'r karich
3 Definition of terms
Assembly languages.
Features of low-level language
1. They are machine hardware-oriented.
2. They are not portable, i.e., a program
written for one computer cannot be
installed and used on another computer
of a different family.
3. They use Mnemonic codes.
4. They frequently use symbolic addresses
zn'r karich
Machine languages (1st Generation languages)
Machine language is written using machine codes (binary digits) that consist of 0’s
& 1’s.
A machine code instruction is made up of 2 main parts;
An Address (operand): It specifies the location (address) of the computer
memory where the data to be worked upon can be found.
A Function (operation) code: It states to the Control Unit of the CPU what
operation should be performed on the data/item held in the address, e.g.,
Addition, Subtraction, Division, Multiplication,
advantages
disadvantage
zn'r karich
Assembly language (2nd Generation
Languages).
Assembly languages were developed in order to
speed up programming (i.e., to overcome the
difficulties of understanding and using machine
languages).
advantages
disadvantages- individual
assigment
zn'r karich
Advantages of Low-level languages
They require less memory space.
Low-level languages are stable, i.e., they do not crash
once written.
The CPU can easily understand machine language
without translation.
The program instructions can be executed by the
hardware (processor) much faster. This is because;
complex instructions are already broken down into
smaller simpler ones.
Low-level languages have a closer control over the
hardware, are highly efficient & allow direct control of
each operation.
zn'r karich
Disadvantages of Low-level languages
Relating the program & the problem structures is difficult, and therefore
cumbersome to work with.
The programs are very long; hence, writing a program in a low-level language is
usually tedious & time consuming.
Low-level languages are difficult to learn, understand, and write programs in
them.
Low-level language programs are difficult to debug (remove errors from).
Low-level languages have a collection of very detailed & complex instructions
that control the internal circuiting of the computer
Low level languages are machine-dependent (specific), hence non-portable.
It is not easy to revise the program, because this will mean re-writing the program
again.
The programs are difficult to develop, maintain, and are also prone to errors.
MR MANZA
HIGH-LEVEL PROGRAMMING LANGUAGES
High-level languages were developed to solve (overcome) the problems
encountered in low-level programming languages
Programs written in a high-level language cannot be obeyed by the
computer hardware directly. Therefore, the source codes must be
translated into their corresponding machine language equivalent .
zn'r karich
Features of high-level programming languages.
They contain statements that have an extensive vocabulary of words,
symbols, sentences & mathematical expressions
They require one to obey a set of rules when writing the program.
Programs written in high-level languages are shorter than their low-
level language equivalents.
The programs are portable between different computers.
Allow modularization (sub-routines).
They are ‘user-friendly’ and problem-oriented rather than machine-
based.
zn'r karich
Purpose of High-level languages.
To improve the productivity of a programmer.
i. To ease the training of new programmers, since
there is no need to learn the detailed layout of a
procession/sequence.
ii. To speed up testing & error correction.
iii. To make programs easy to understand & follow.
zn'r karich
Advantages of High-level languages.
They are easily portable, i.e., they can be transferred between computers of
different families and run with little or no modification.
High-level language programs are short, and take shorter time to be translated.
They are easy to debug (correct/remove errors), & maintain.
High level language programs are easy to modify, and also to incorporate
additional features thus enhancing its functional capabilities.
They are ‘&user-friendly’ problem-oriented
They enable programmers to adapt easily to new hardware
High-level language programs are self-documenting,
High level languages are more flexible;
zn'r karich
Disadvantages of using High-level
languages
High-level languages are not machine-oriented; hence, they do not use of
the CPU and hardware facilities efficiently.
The languages are machine-independent, and cannot be used in programming
the hardware directly.
Each high-level language statement converts into several machine code
instructions.
Their program statements are too general; hence, they execute slowly than
their machine code program equivalents
The languages cannot be used on very small computers.
They have to be interpreted or compiled to machine-readable form before the
computer can execute them.
zn'r karich
TYPES OF HIGH-LEVEL LANGUAGES.
1. Third generation languages (Structured / Procedural languages).
2. Fourth generation languages (4GLs).
3. Fifth generation languages (5GLs)
4. Object-oriented programming languages (OOPs).
5. Web scripting languages.
CONT’..
Sequence
Selection.
Iteration (looping).
Advantages of structured programming
It is flexible.
Structured programs are easier to read.
Programs are easy to modify because; a programmer can change the
details of a section without affecting the rest of the program.
It is easier to document specific tasks.
Use of modules that contain standard procedures throughout the
program saves development time.
Modules can be named in such a way that, they are consistent and easy
to find in documentation.
Debugging is easier because; each module can be designed, coded &
tested independently
Examples of Third generation
programming languages
PASCAL
COBOL
BASIC
C
FOURTH GENERATION LANGUAGES (4GL’S)
4GLs are used to enquire & access the data stored in database systems;
hence, they are described as the Query languages.
Purpose of fourth generation languages.
To speed up the application-building process, thereby increasing the
productivity of a programmer.
To enable quick & easy amendments and alteration of programs.
To reduce development & maintenance costs.
To make languages user-friendly
CONT’..
The 5GL’s are designed to make a computer solve a problem by portraying human-like
intelligence.
5GLs are mostly used in artificial intelligence.
Examples of 5GLs
Simula
C++
SmallTalk
Java
WEB SCRIPTING LANGUAGES
HTML PERL
JAVASCRIPT PYTHON
PHP APPLESCRIPT
Comparison of Programming
languages
CONT’..
Factors to consider when choosing a
Programming language
The availability of the relevant translator
Whether the programmer is familiar with the language
Ease of learning and use
Purpose of the program, i.e., application areas such as education,
business, scientific.
Execution time. Applications that require quick response are best
programmed in machine code or assembly language.
CONT’…