1 Introduction to Programming
1 Introduction to Programming
Learning Outcome
1
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING
Programming
Language
Machine Assembly
Language Language
Concept Check:
2
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING
A programming language is a set of words, abbreviations, and symbols that enables a programmer to create
instructions for a program /software/apps.
Types of Low-Level Language: Machine Language Types of Low-Level Language: Assembly Language
Definition: Definition:
▪ Machine language is the first generation of programming ▪ Assembly language is the second generation of
languages where instructions are written using series of programming languages where instructions are written
binary digits (1s and 0s). using symbolic instruction codes which are meaningful
abbreviations.
Example: To calculate wages = rates * hours Example: To calculate wages = rates * hours
100100 010001 //Load rates
100110 010010 //Multiply hours
100010 010011 //Store wages
▪ Ready for immediate ▪ Programs are not easily ▪ Programs are not easily
execution. portable to other types of portable to other types
computers. of computers.
3
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING
A programming language is a set of words, abbreviations, and symbols that enables a programmer to create
instructions for a program /software/apps.
▪ Programmers must translate a high-level language program (source program) into machine language before the
computer can execute, or run, the program.
Example: To calculate wages = rates * hours in Java
▪ Examples of high-level language: Basic, FORTRAN, COBOL, Pascal, C, C++, C#, and Java.
Advantages Disadvantages
▪ Instructions are easier to learn compared to low-level ▪ Not readily understood by computer, thus need to be
languages because instructions are written using series of translated to machine language.
English-like words.
▪ Machine-independent language can run on many different
types of computers and operating systems.
4
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING
OR
▪ A programming paradigm is an approach to programming a computer based on a mathematical
theory or a coherent set of principles.
double getArea(int r) {
double area;
area = 3.142 * r * r;
return area;
}
Logic-Oriented ▪ The logic programming paradigm uses automated reasoning to
Programming compute over a set of facts and rules.
5
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING
circle1.getArea(); }
6
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING
Language Translator: is defined as a computer program that translates instructions (source program)
written in one programming language to be translated to machine language.
7
Topic 1
1.0 INTRODUCTION TO PROGRAMMING
PROGRAMMING