Lecture 05: Computer Software & Prog.
CS 101: Introduction to Computing
Computer Software and Programming
Muhammad Abdullah Akmal
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Computer Programming
• Computer programming is the process of writing
instructions that direct a computer to carry out specific
tasks
• A computer program is a set of step-by-step
instructions that tell a computer how to solve a problem
or carry out a task
• The instructions that make up a computer program
are often referred to as code
• A program is written in a computer programming
language
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Programming Languages (-1-)
• A programming language is an artificial
language designed for creating instructions that a
computer can carry out
– In contrast, the languages we speak [e.g., English/Urdu] are
natural languages
• Programming languages differ from natural
languages in that
– natural languages are used for interaction between
people
– programming languages allow humans to communicate
instructions to machines as well as machine-to-machine
interaction
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Programming Languages (-2-)
• Programming languages can be divided into two major
categories
– Low-level languages
• Requires programmer to write instructions for the lowest level of
computer’s hardware
– Easy for computer to understand; Difficult for humans
• Examples: Machine Language, Assembly Language
– High-level languages
• Makes programming process easier by providing commands
such as PRINT or WRITE instead of unintelligible strings of 1s
and 0s
• Examples: FORTRAN, C, C++, Java, Python …
• Languages can also be categorized by generations
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Programming Language Categorization
3GL, 4GL HIGH-LEVEL
LANGUAGES
2GL
ASSEMBLY LANGUAGE LOW-LEVEL
LANGUAGES
1st Generation
Language [1GL] MACHINE LANGUAGE
HARDWARE
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Machine Language /
Machine Code
• The first languages for programming computers – sometimes
referred to as first-generation languages
– Consists of a set of commands, represented as a series of 1s
and 0s, corresponding to the instruction set understood by a
microprocessor
– A machine language is specific to a particular CPU or
microprocessor family
• High-level languages are (mostly) translated [compiled] to
machine language in order to be understood and executed by
the microprocessor
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Assembly Language
• Allows programmers to use abbreviated command words
rather than 1s and 0s used in machine languages
– A significant improvement over machine languages
• Mnemonics such as ADD, SUB, MUL, DIV, JMP etc
are more understandable than 0001, 0100 etc
– Also referred to as second-generation languages
– Assembly languages are also machine specific
• Each assembly language command corresponds on a
one-to-one basis to a machine language instruction
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Algorithm
A concept that pervades all areas of computer science.
Algorithm is a process that a computer could carry out to
complete a well defined task within finite time and
resources.
The objective of computer science is to solve problems
by developing, analyzing, and implementing
algorithmic solutions.
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Al-Khwarizmi Principle
• All complex problems can be broken into simpler
sub-problems.
• Solve a complex problem by breaking it down into
smaller sub-problems and then solve them (in a
specified order), one at a time.
• When all the steps are solved, the original problem
itself has also been solved.
• This process is called Algorithm.
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
Computer Programming
• Computer is a powerful tool
• It is not intelligent!
• In order to use computer to solve our problems, we
must tell it what we want done and the order in which
we want it done.
• These instructions are called computer program.
• This process is called computer programming.
• The person giving these instructions is called a
computer programmer.
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi
Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing
References
• Computer Concepts, by Parsons & Oja
[Chapters 3]
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi