You are on page 1of 26

Faculty of Computer Science

Introduction to Programming

Lecturer: Lutfullah “Haqnesar”


Introduction to Programming

Chapter 1

Introduction
Introduction to Programming

Learning outcomes:
What is Programming Language
Types of Programming Language
Low Level Programming Language
High Level Programming Language
Procedure oriented programming
Object Oriented programming
Programming language translator
Introduction to Programming
Introduction to Programming

Programming Language

As we know, to communicate with a person, we need a specific


language, similarly to communicate with computers, programmers also
need a language is called Programming language.
Introduction to Programming

What is Language?

Language is a mode of communication that is used to share ideas,


opinions with each other.
For example, if we want to teach someone, we need a language that
is understandable by both communicators.
Introduction to Programming

What is a Programming Language?

• A programming language is a computer language that is used by


programmers (developers) to communicate with computers.
• A programming language is mainly used to develop desktop
applications, websites, and mobile applications.
• We have different programming language like C, C++, Java, Python
which is used by the programmers for writing programs, to perform a
specific task.
Introduction to Programming

Program
• A computer program is a collection of instructions that can
be executed by a computer to perform a specific task.
• A program is a set of instructions that a computer uses to perform a
specific function.
• A computer program is written using specific programming languages
by programmers in a programming language like C, C++, JAVA,
Python and etc.
Introduction to Programming

Types of programming language

Programming language are classified into two types:


1. Low-level programming language
2. High-level programming language
Introduction to Programming

1. Low-level Programming Language

Low-level language is machine-dependent (0s and 1s) programming language.


The processor runs low- level programs directly without the need of a
compiler or interpreter, so the programs written in low-level language can be
run very fast.

Low-level language is further divided into two parts:


1. Machine Language
2. Assembly Language
Introduction to Programming

1.1 Machine Language:

Machine language is a type of low-level programming language.


It is also called as machine code or object code.
Machine language is easier to read because it is normally displayed in
binary or hexadecimal form (base 16) form.
It does not require a translator to convert the programs because
computers directly understand the machine language programs.
Introduction to Programming

1.2 Assembly Language

• Assembly language is also a type of low-level programming language.


• It represents the set of instructions in a symbolic and human-
understandable form.
• It uses an assembler to convert the assembly language to machine
language.
• The advantage of assembly language is that it requires less memory
and less execution time to execute a program.
Introduction to Programming
Differences between Machine language and Assembly language
Machine Language Assembly Language
Machine language is only understand by the Assembly language is only understand by human
computers. beings not by the computers.
In assembly language data can be represented with
In machine language data is represented with the the help of mnemonics such as Mov, Add, Sub, End
help of binary format(0s and 1s). etc.
Machine language is very difficult to understand by Assembly language is easy to understand by the
the human. human as compare to machine language.
Execution is fast in machine language because all Execution is slow as compared to machine
data is already present in binary format. language.

There is no need of translator. Assembler is used as translator.


Introduction to Programming

2. High-level Programming Language


• High-level programming language is a type of programming language designed
for developing user-friendly software programs.
• This programming language requires a compiler or interpreter to translate the
program into machine language.
• The main advantage of a high-level language is that it is easy to read, write, and
maintain.
• High-level programming language includes Python, Java, JavaScript, PHP, C#, C++,
C and etc.
Introduction to Programming

2. High-level Programming Language

A high-level language is further can be divided into two parts:


1. Procedural Oriented programming language
2. Object-Oriented Programming language
Introduction to Programming

2.1 Procedural Oriented Programming Language

• Procedural Oriented Programming (POP) language is based upon the


procedure call concept. It divides a program into small procedures called
routines or functions.
• The advantage of POP language is that it helps programmers to easily track
the program flow and code can be reused in different parts of the program.
• Examples of POP languages are C, FORTRAN, Basic, Pascal, etc.
Introduction to Programming

2.2 Object-Oriented Programming language

• Object-oriented programming language is a programming paradigm


which is based on the concept of "objects“.
• It is used to implement real-world entities like inheritance,
polymorphism, abstraction, etc, in the program.
• OOP is faster and easier to execute, maintain, modify, as well as debug.
• Example: C++, Java, Python, C#, etc.
Introduction to Programming
Differences between Low-Level and High-Level language
High Level Language Low Level Language
It is programmer friendly language. It is a machine friendly language.
It is easy to understand. It is tough to understand.
It is simple to debug. It is complex to debug comparatively.
It needs compiler or interpreter for It needs assembler for translation.
translation.

It is used widely for programming. It is not commonly used now-a-days in


programming.
Introduction to Programming
Programming Language Translators
 Translators
are programs, which translate programs written in any high or assembly
language into machine language (1’s and 0’s).
 There are three types of language translators:
1. Assembler
2. Compiler
3. Interpreter

Program code Language Machine code


translator
Introduction to Programming

1. Assembler
An assembler is a translator used to translate assembly language into machine
language.
An assembler translates a low-level language, such as an assembly language to
an even lower-level language, such as the machine code.

Source Program Assembler Machine code


Introduction to Programming

2. Compiler
A compiler is a translator used to convert high-level programming language to
low-level programming language.
It converts the whole program in one session and reports errors detected after
the conversion.

Source Program Compiler Machine code


Introduction to Programming

3. Interpreter
Interpreter is a translator used to convert high-level programming language to
low-level programming language.
The difference is that it converts the program one line of code at a time and
reports errors when detected, while also doing the conversion.

Source Program Interpreter Machine code


Introduction to Programming

Linker
A linker tool is used to link all the parts of the program together for
execution (executable machine code).

A linker is a program that takes one or more objects generated by a


compiler and combines them into a single executable program.
Introduction to Programming

Loader
A loader is the part of an operating system that is responsible for
loading programs in memory, one of the essential stages in the
process of starting a program.
Introduction to Programming

Thank You
For Your Patience

You might also like