2. Computer Programming
• Program
• Set of statements (instructions that instruct computers on what to do
• Written using programming languages
• The program development process is referred to as programming
• It’s developed by programmers
• A program can instruct computers to:
• Read/accept input data
• Calculate or compare
• Store data
• Display output and communication messages
• Software
• Is a computer program with its associate documentation
3. Programming Languages
• A natural language has a systematic method of using symbols of the
language.
• Dedicated by rules of grammar
• Syntax: set of rules needed to ensure a sentence is grammatically correct
• Semantic: refers to meaning
• Each programming language is governed by syntax and semantics
• In natural languages the syntax rule can be broken but we can use the
guess work to get what someone is saying
• Exact syntax rules of programming languages have to be followed for
computers to understand
4. Types of Programming Languages
• Can be classified into two:
• Low-level languages - machine dependent
• First Generation – Machine Languages
• Second Generation – Assembly Languages
• High-level languages – Machine independent
• Third Generation – Procedural Languages
• Fourth Generation – Problem Oriented Languages
• Fifth Generation – Natural Languages
5. 1GL- Machine Language
• Writes programs inform of 1s and 0s which are directly understood by
the computer
• E.g., Below is a machine code
• Fast to execute
• Time consuming and tedious to interprete
• Very easy to make a mistake and hard to identify the mistake
6. 2GL – Assembly Language
• Written using mnemonic codes (abbreviated English words)
• The codes represent operations and addresses related to the main
memory and storage registers, e.g., LDA, STO, ADD, NOP, etc
• Have to be translated to machine language to the processor to
understand
• Example:
• program to add and
store two numbers
would be
7. 3GL – Procedural Languages
• Uses human like language
• Intended to solve general problems
• E.g., C, PASCAL, COBOL, FORTRAN, etc.
• Have to be translated into machine language so as to be understood
by the computers
• The translation is done by either a compiler or an interpreter
depending on the language.
8. Language Translators
• A Compiler:
• Translates the entire program (source code) into a machine language (object
code)
• The object code can be save on a disk with .exe extension.
• It is then loaded and executed.
9. Translators cont..
• An Interpreter:
• Interprets and executes one instruction at a time.
• The machine codes are not saved after execution.
10. Translators cont..
• An Assembler:
• Translates an assembly language program into machine language
• Recognizes the mnemonic characters and substitutes them with machine
codes for each instruction
11. 4GL - Problem-Oriented Languages
• Designed to solve specific problems
• Non-procedural and focus on specifying what the program is to
achieve
• More like English and easy to program
• Used for specific applications, e.g.,
• Query Languages such as SQL, etc
• Application generators such as Visual Basic
12. 5GL – Natural Programming Languages
• Computer Languages have become more human-like
• Though still far from English, Lugbara, Luganda, etc
• Computer language that incorporates AI to allow direct human
communication, e.g., PROLOG, LISP, etc
• Enable computers to run and apply new information like humans
13. References
• Samuel Kizito, “Introduction to Computer Programming,” [Online],
Available: https://www.slideserve.com/nortonm/introduction-to-
computer-programming-powerpoint-ppt-presentation