Intro to
Programming
Walid Belal
Winter 2024
PROG12583
• Identify main computer
components
Objectives • Describe different program types
• Recognize programming
languages categories
Computer
An electronic device
Processes data
Computer Stores Data
• Speed
Why Do • Accuracy
We Need • Reliability
• Storage Capacity
Computers • Versatility
• Diligence
• Resource Sharing
Components of a Computer System
Input Output
Memory
• Input
• Output
CPU • Central Processing Unit (CPU)
• Memory
Control Unit Central Processing Unit (CPU)
• Fetches instructions from
memory and interprets
them and ensure correct
execution
• Controls input and output
devices • Is the brain of the computer
• Ensures correct sequence
of operations • Works with data in either 0 or 1
• Consists of
Registers Arithmetic/ Logic Unit
• Memory units that hold the • performs arithmetic and
Control Unit
information that the CPU logical operations on data
is working with Arithmetic/ Logic Unit
Registers
CPU only understand machine language instructions Zeros
and Ones
How are The entire set of instructions that a C P U can execute is
known as the C P U ’ s instruction set
Instructions Each brand of microprocessors (Intel, A M D, and Motorola)
has a unique instruction set
executed? Instructions are executed in the following four steps
1. Fetch: Get instructions from memory
2. Decode: Translate it into commands that a computer will
understand
3. Execute: Cary out the command
4. Store: Write the result to memory
Is a hardware that is used to input instructions
into the computer. These instructions are
Input and
converted from a format that is understandable by
humans into a format that a computer
understands
Output
Devices
Output devices convert machine code into a
format that can be understood by human
Write some examples for input and output devices
Input Device Output Device
1. ______________ 1. ______________
2. ______________ 2. ______________
3. ______________ 3. ______________
Storage unit where the program data is stored
Two types of storage
Memory Primary memory: Fast and volatile CPU can
directly interact with it. Random Access Memory
RAM (volatile) and Read Only Memory ROM
(non-volatile) are primary memory
Secondary Memory: Used to store program data
even when the computer does not have power.
Examples of secondary memory is hard disk drive
HDD , solid state drive SSD, and USB drives
Find some similarities between
computer and a person
1. ______________
2. ______________
3. ______________
4. ______________
Program
Set of instructions that the computer
execute to perform a task
What is a Software is a term used to describe
Program?
programs
Programs are written by programmers
or software developers
1. ______________
Write down few examples
2. ______________
of computer programs that
you use on daily basis 3. ______________
4. ______________
Computer Software
Software
System Application
Software Software
System Management System Development
Program Program
Integrated Programming
Operating Utilities and
Development language
Systems Drivers
Environment IDE Translator
Software Hardware Interaction
Application Software
• System Management Software (OS) is
responsible for controlling and
managing hardware components
System Management
Software
• System Management Software
manages the execution of the
Hardware programs and provides resources to
the programs.
Programing language
Is a language (System of notations) that is
used to write a computer program.
Programming Programming languages is composed of
Language • Syntax: The rules on how to make a
correct sentence
• Semantics: The meaning of the sentence
• Machine language
Programming • Assembly Language
language
Categories • High Level Language
Example of
Machine language
machine code
• Consist of binary code 0 and 1
• Is the language that the CPU
01100110 understands
00001010 • Difficult to write by programmers
• Each brand of microprocessors (Intel,
A M D, and Motorola) has a unique
instruction set
Assembly Language
• Low level programming language
• Uses mnemonics (abbreviated
operations) and operands to code
• Each statement usually translate to
one machine code instruction 1:1
• Easier to write than machine code
• A translator program (Assembler) is
used to translate assembly code to
machine code
High level Languages
• Many languages (e.g. Python, Java ,C++ etc)
• Uses natural language constructs.
• Is called source code.
• Abstracted from machine code, Statements
do not have 1:1 translation with machine
code.
• Do not need to know machine code
instructions to write programs.
• Uses a translator program (compiler or
interpreter) to convert the code to machine
code.
Compiler vs Interpreter
• Compiler reads the whole source code and
translate it to machine code
• Interpreter translate line by line
• Compiler needs time to create the
executable code but the executable code
will execute faster
• Interpreter is spontaneous as translate line
by line however it is lower than executing a
compiled program
Reference
Limited, I., & Sargunar, J. (2011). Introduction to computer science (2nd ed.). Pearson Education India.
https://searchlibrary.sheridancollege.ca/permalink/01OCLS_SHER/hhg492/alma991004442209107306