1 Introduction
1 Introduction
programming
Alianda |@UMMA
Basic Computer Terminologies:
• Computer
• Software
• Hardware
• State Factors to consider when you want to buy computer software and
hardware?
• State the classification of computer software?
Alianda |@UMMA
Introduction to structured programming
• Programming means to convert problem solutions into instructions for
the computer.
• It also refers to the process of developing and implementing various
sets of instructions to enable a computer to do a certain task.
• Structured programming (sometimes known as modular programming)
is an approach to writing programs that are easier to test, debug,
modify and maintain by enforcing a modular approach which breaks a
large complex problem into sub-problems.
Alianda |@UMMA
What is computer programming?
• Computer programming (often shortened to programming or coding).
• It is the process of designing, writing, testing, debugging, and
maintaining the source code of computer programs.
• This source code is written in one or more programming languages.
Alianda |@UMMA
…
• A computer program (also software, or just a program) is a sequence
of instructions written to perform a specified task with a computer.
• A computer program is written by a programmer. Computer
programmers write in a programming language.
• Q: State examples of programming languages.
• Q: Discus IT careers and qualifications.
Alianda |@UMMA
History of programming
languages
Alianda |@UMMA
First-Generation Programming Languages –
Machine Language
• A first-generation of programming languages includes machine-level
programming languages.
• These languages were introduced in the 1940s and had the following
characteristics:
⁃ Instructions were entered directly in binary format (1s and 0s) and therefore
they were tedious and error prone. Programmers had to design their code by
hand then transfer it to a computer using a punch card, punch tape or flicking
switches.
⁃ Instructions were executed directly by a computer's central processing unit
(CPU) i.e. they were executed very fast.
⁃ Memory management was done manually.
⁃ Programs were very difficult to edit and debug.
⁃ Used to code simple programs only.
Alianda |@UMMA
Characteristics of machine language
1. Instructions/Data entered directly in binary
2. Memory must be manually moved around
3. Very difficult to edit/debug.
4. Simple programs only.
5. Instructions correspond directly to the hardware it was written.(They are
specific machine dependent).
6. Computers can understand and execute it directly
7. It uses binary
8. Machine dependent
9. Time consuming
10. No translator was used to compile or assemble the first-generation language.
Alianda |@UMMA
Advantages of machine languages.
Alianda |@UMMA
Disadvantages of machine languages.
1. Programmers have to write computer programs using 0’s and 1’s which is
very difficult to read and debug.
2. They are machine dependent hence their portability is hard.
3. Difficult to learn edit, or debug since programs are written in 0’s and 1’s.
4. All machine operation codes have to be memorized.
5. Modification of completed programs is very difficult and slow.
6. Programs are long hence difficult to read and debug.
Alianda |@UMMA
Second-Generation Programming Languages
(2GL) – Low Level Programming
Languages/Assembly Languages
• They were introduced to mitigate the error prone and excessively
difficult nature of binary programming.
⁃ Introduced in the 1950s
⁃ Improved on first generation by providing human readable source code which
must be
⁃ compiled/assembled into machine code (binary instructions) before it can be
executed by a CPU
⁃ Specific to platform architecture i.e. 2GL source code is not portable across
processors or processing environments.
⁃ Designed to support logical structure and debugging.
Alianda |@UMMA
…
• By using codes resembling English, programming becomes much
easier. The use of these mnemonic codes such as LDA for load and
STA for store means the code is easier to read and write.
Alianda |@UMMA
…
• Assembly Code • Machine Code
• LDA A • 000100110100
• ADD #5 • 001000000101
• STA A -> Assembler -> • 001100110100
• JMP #3 • 010000000011
Alianda |@UMMA
…
• Such languages are sometimes still used for kernels and device
drivers, i.e. the core of the operating system and for specific machine
parts. More often, such languages are used in areas of intense
processing, like graphics programming, when the code needs to be
optimized for performance.
Alianda |@UMMA
Characteristics of 2GL.
Alianda |@UMMA
• Written by a programmer in an intermediate instruction language
which is later compiled into binary instructions
• Specific to platform architecture.
• Designed to support logical structure.
• Defined by three language elements: Opcodes (CPU Instructions),
Data Sections (Variable Definitions) and Directive (Macros).
• They use mnemonics of human language. i.e english like acronyms to
speed up programming. Eg. Add, sum. Etc.
Alianda |@UMMA
• A program called an assembler is used to translate these words into
machine language.
• Advantages.
1. Its easier to understand , use and modify.
2. Programs have less error chances as compared to machine
language.
3. They utilize memory and efficiently and effectively.
4. Program development takes less time than machine language.
Alianda |@UMMA
Disadvantages.
1. Like machine language, assembly language is designed for a specific
machine and specific micro processor. This implies that programs
cannot be moved from one computer architecture to another without
re-writing the code. ( Which means learning another assembler
language).
2. They require an extra software for translation the assembler.
3. They are slow in execution.
4. They require skilled programmers.
Alianda |@UMMA
Third-Generation Languages (3GL) – High-
Level Languages
• Third generation languages are the primary languages used in general
purpose programming today. They each vary quite widely in terms of their
particular abstractions and syntax. However, they all share great
enhancements in logical structure over assembly languages.
⁃ Introduced in the 1950s
⁃ Designed around ease of use for the programmer (Programmer friendly)
⁃ Driven by desire for reduction in bugs, increases in code reuse
⁃ Based on natural language
⁃ Often designed with structured programming in mind
⁃ The languages are architecture independent e.g. C, Java etc.
• Examples:
• Most Modern General Purpose Languages such as C, C++, C#, Java, Basic,
COBOL, Lisp and ML.
Alianda |@UMMA
Characteristics
1. Third Generation programming languages are High level Programming
languages like JAVA & C.
2. Designed around ease of use for the programmer
3. Driven by desire for reduction in bugs, increases in code reuse Based on
natural language
4. Often designed with structured programming in mind.
5. They use control structures to control the program logic.
6. They contain subroutine and procedures.
7. They require a compiler or an interpreter as a translation software.
8. They make use of data structures that define how data is organized.
9. Programs written in high level languages are shorter than their low level
equivalents, since one statement translates into several machine code
instructions.
Alianda |@UMMA
Languages:
Cobol – common business oriented language.
Fortran – FORmula TRANslation Language.
Basic – Beginers all purpose sysmbolic instruction code.
Pascal.
C.
LISP.
PROLOG – PROgramming in LOGic.
LOGO
C++, C#, Java, Basic, COBOL, Lisp and ML
Alianda |@UMMA
Fourth Generation Languages
• Fourth-generation programming languages are high-level languages
built around database systems. They are generally used in commercial
environments.
⁃ Improves on 3GL and their development methods with higher abstraction and
statement power, to reduce errors and increase development speed by reducing
programming effort. They result in a reduction in the cost of software
development.
⁃ A 4GL is designed with a specific purpose in mind. For example languages to
query databases (SQL), languages to make reports (Oracle Reports) etc.
⁃ 4GL are more oriented towards problem solving and systems engineering.
⁃ Examples: Progress 4GL, PL/SQL, Oracle Reports, Revolution language,
SAS, SPSS, SQ
Alianda |@UMMA
They were designed to meet the following objectives.
Alianda |@UMMA
General characteristics of 4GL are:
1. Closer to human languages
2. Portable
3. Database supportive
4. Simple and requires less effort than 3GL
5. Non procedural
Alianda |@UMMA
Different types of 4 GL are:
1. Query Generator
2. Report generator
3. Form Generator
4. Application Generator
5. GUI Generator
6. Relational Database Manager
Alianda |@UMMA
Fifth Generation Languages
• Improves on the previous generations by skipping algorithm writing
and instead provide constraints/conditions.
• While 4GL are designed to build specific programs, 5GL are designed
to make the computer solve a given problem without the programmer.
• The programmer only needs to worry about what problems needed to
be solved and only inputs a set of logical constraints, with no specified
algorithm, and the Artificial Intelligence (AI)-based compiler builds
the program based on these constraints
• Examples: Prolog, OPS5, Mercury
Alianda |@UMMA
Abbreviations used:
1. AI-Artificial Intelligence
2. 1GL-First Generation Programming Language
3. 2GL-Second Generation Programming Language
4. 3GL-Third Generation Programming Language
5. 4GL-Fourth Generation Programming Language
6. 5GL-Fifth Generation Programming Language
Alianda |@UMMA
Low-Level Languages Versus High-Level
Languages
Low-level languages such as machine language and assembly language are
closer to the hardware than are the high-level programming languages, which
are closer to human languages.
Low-level languages are converted to machine code without using a compiler
or interpreter, and the resulting code runs directly on the processor.
A program written in a low-level language runs very quickly, and with a very
small memory footprint; an equivalent program in a high-level language
will be more heavyweight. Low-level languages are simple, but are
considered difficult to use, due to the numerous technical details which must
be remembered.
Alianda |@UMMA
…
• High-level languages are closer to human languages and further from
machine languages.
• The main advantage of high-level languages over low-level languages
is that they are easier to read, write, and maintain. Ultimately,
programs written in a high-level language must be translated into
machine language by a compiler or interpreter.
• The first high-level programming languages were designed in the
1950s. Now there are dozens of different languages, including Ada,
Algol, BASIC, COBOL, C, C++, FORTRAN, LISP, Pascal, and
Prolog.
Alianda |@UMMA
END
Alianda |@UMMA