0% found this document useful (0 votes)
6 views27 pages

Week 1 Lecture 2

The document introduces the concepts of programming languages, explaining their purpose as a means of communication between humans and computers through syntax and semantics. It covers the roles of compilers and interpreters in converting high-level languages like Java into machine language, as well as the importance of data types and memory in programming. Additionally, it outlines how computer programs process input data to produce output information, emphasizing their utility in solving various problems.

Uploaded by

aishadaike
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views27 pages

Week 1 Lecture 2

The document introduces the concepts of programming languages, explaining their purpose as a means of communication between humans and computers through syntax and semantics. It covers the roles of compilers and interpreters in converting high-level languages like Java into machine language, as well as the importance of data types and memory in programming. Additionally, it outlines how computer programs process input data to produce output information, emphasizing their utility in solving various problems.

Uploaded by

aishadaike
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PROGRAMMING 1

CONCEPTS OF PROGRAMMING LANGUAGE


WEEK 1; LECTURE 2

Hasan J. Alyamani
CONTENTS

 What is a programming language?


 Computer program.

 Hardware in programming.

 Data types.

 Memory.

 Memory and data types.


WHAT IS A PROGRAMMING LANGUAGE?

 Language: is a collection of words in a certain


order (syntax) which has a meaning (semantic)
to help people to communicate.
 Both Mr.A and Mr. speak Arabic.

Understands Mr.A

Understands Mr.B
Mr.A Mr.B
WHAT IS A PROGRAMMING LANGUAGE?

 Mr.A speaks Arabic whereas Mr.B speaks


English.

Mr.A Mr.B

Mr.X
WHAT IS A PROGRAMMING LANGUAGE?

 Mr.X is an interpreter.
 Mr.X is a compiler.

Mr.A Mr.B

Mr.X
WHAT IS A PROGRAMMING LANGUAGE?

 Programming: a set of written instructions


(language) to make the computer does
something.
 Computer understands a “Machine language”.

 Machine language: is a bit numerical system


(binary digit) 0 and 1.
 A = 01000001 a=01100001

Machine language
WHAT IS A PROGRAMMING LANGUAGE?

 Computer speaks “machine language”.


 Mr.A speaks English.

 Do they understand each other?

 What does Mr.A need?

Machine
X Human
language language
WHAT IS A PROGRAMMING LANGUAGE?
 Mr.A needs:
 1) Learn a programming language.
 2) A compiler/interpreter.
 Compiler/interpreter to convert the whole code
to machine language.

Machine Low-level Mid-level High-level Human


language language language language language
WHAT IS A PROGRAMMING LANGUAGE?

 Compiler: convert the


whole code to
machine language.
 Interpreter: convert
the code line by line.
WHAT IS A PROGRAMMING LANGUAGE?

 High-level language: Java => Java is a high-level


programming language.
 Java offers a compiler to convert the code to
low-level language then an interpreter is used
to convert the code to the machine language.

Java

Machine Low-level Mid-level High-level Human


language language language language language
SOLVING PROBLEMS

 Programs are used to solve different kinds of


problems to:
 Save our time
 Save out effort

 Keep out information safe


SOLVING PROBLEMS
 Problems might are simple or complex to be
solved
 Mathematical problems:
 Area and perimeter of shapes.
 Algebraic equations

 Physical problems:
 Volume, acceleration
 Archiving:
 Store, organize and retrieve data.
COMPUTER PROGRAM
 Computer program: a set of instructions that
processes input data to get information that solves
a certain problem.
 1) input (data)
 2) process (instruction)
 3) output (information)

2
Java
1

3
HARDWARE IN PROGRAMMING

 Input: keyboard, touchable screen, scanner,…


 Processing data: memory

 Output: printer, screen, …


DATA TYPES
 Primitive data type
Category Data type Examples
Numerical data byte (3 places) 100; -60; 9
short (5 places) 10005; -87035
int (6 places) 985647; -789010
Float (floating 235.5f; -985.2f
point)
Double (floating 654.5; -78.1
point)
Logical data boolean true; false
Alphabetical data char ‘A’; ‘a’

 Reference data type


 String. Ex: “programming 1”
MEMORY

 Computer program uses memory to store data


in order to process it or use it later.
 Each data type has a specific size and type in
memory.
int float double boolean char

String
MEMORY AND DATA TYPES
int

float ‘j’

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
53.1f

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
true

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
69

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
“computer”

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
“6.56”

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
5+6

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
9+36.5

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
14/2

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
1/3

double

?
boolean

char

String
MEMORY AND DATA TYPES
int

float
“Computer” + “ ” + “Science”

double

?
boolean

char

String

You might also like