You are on page 1of 15

INTRODUCTION TO

PROGRAMMING
Week 1 – Part 1
CSC 1164
COMPUTER
PROGRAM  A program is a set of instructions following the
rules of the chosen language.
 Without programs, computers are useless.
 A program, also called an application or software,
is a set of instructions that process input,
manipulate data, and output a result. For example,
Microsoft Word is a word processing application
that allows users to create and write documents.
 A program is like a recipe, it contains a list of
ingredients (called variables) and a list of
directions (called statements) that tell the
computer what to do with the variables.
 Instructions must be written in a way that the
computer can understand.
 Programming languages are used to write
programs.
DEFINITION OF PROGRAM
• A set of instructions that tells a computer to
perform tasks.
 
COMPUTER PROGRAMMING
• Computer programming is the process of writing,
DEFINATION testing, debugging/troubleshooting, and maintaining
the source code of computer programs.
• This source code is written in a programming
language like C++, JAVA, Perl etc.

COMPUTER PROGRAMMER

• A programmer is someone who writes computer


program.
• Computer programmers write, test, and maintain
programs or software that tell the computer what to
do.
• A set of words, symbols and codes that enables a
DEFINITION programmer to give instruction to a computer.
• A vocabulary and set of grammatical rules (syntax) for
OF instructing a computer to perform specific tasks.
• Programming languages can be used to create computer
PROGRAM- programs.
• The term programming language usually refers to high-
MING level languages, such as BASIC, C, C++, COBOL,
FORTRAN, Ada, and Pascal.
LANGUAGE • The most basic (called low-level) computer language is the
machine language that uses binary ('1' and '0') code which
a computer can run (execute) very fast without using any
translator or interpreter program, but is tedious and
complex.
• The high-level languages (such as Basic, C, Java) are
much simpler (more 'English-like') to use but need to use
another program (a compiler or an interpreter) to convert
the high-level code into the machine code, and are
therefore slower.
There are three types of programming
TYPES OF language:
1. Machine language (Low-level language)
PROGRAM 2. Assembly language (Low-level
-MING language)
3. High-level language
LANGUAGE
Low-level languages are closer to the
language used by a computer, while high-
level languages are closer to human
languages
LOW LEVEL LANGUAGE
 

a) MACHINE LANGUAGE
 The fundamental language of the computer’s processor, also called Low Level Language.
 Machine language is a collection of binary digits or bits that the computer reads and interprets.
 Also known as machine code or object code, is the elemental language of computers.
 Machine language is the only language a computer is capable of understanding.
 All programs are converted into machine language before they can be executed.
 Is the natural language of a computer.
 Consists of combination of 0’s and 1’s that represent high and low electrical voltage.
 Machine language is a collection of binary digits or bits that the computer reads and interprets.
 Programming language that can be directly understood and obeyed by a machine (computer) without
conversion (translation).
 machine languages are almost impossible for humans to use because they consist entirely of numbers.
LOW LEVEL LANGUAGE
•Examples of code:
1110100010101 111010101110

Example:
•Let us say that an electric toothbrush has a processor and main memory.
•The processor can rotate the bristles left and right, and can check the on/off switch.

The machine instructions are one byte long, and correspond to the following machine operations:
LOW LEVEL LANGUAGE

ADVANTAGE DISADVANTAGE

Instructions are readily understood by the Instructions are extremely cryptic and difficult to
computer learn

Programs are lengthy - a single instruction


Ready for immediate execution corresponds to one operations at the machine
level
ASSEMBLY LANGUAGE
ns are translated into machine language by a program called an assembler
 A program written in assembly language consists of a series of Example :
instructions mnemonics that correspond to a stream of executable
instructions, when translated by an assembler, that can be loaded into
memory and executed.
 Assembly languages use keywords and symbols, much like English, to form
a programming language but at the same time introduce a new problem.
 The problem is that the computer doesn't understand the assembly code,
so we need a way to convert it to machine code, which the computer does
understand.
 Assembly language programs are translated into machine language by a
program called an assembler.
ASSEMBLY LANGUAGE

ADVANTAGE DISADVANTAGE

Not readily understood by computer, thus need to be


translated to machine language before executed
Instructions are easier to learn
compared to machine language
Programs are lengthy - a single instruction
corresponds to one operations at the machine level
HIGH LEVEL LANGUAGE
 
 High-level languages allow us to write computer code using instructions
resembling everyday spoken language (for example: print, if, while) which are
then translated into machine language to be executed.
 Programs written in a high-level language need to be translated into machine
language before they can be executed.
 Some programming languages use a compiler to perform this translation and
others use an interpreter.
 Examples of high level language : FORTRAN, COBOL, BASIC, Pascal, Ada, C ,
Phyton
HIGH LEVEL LANGUAGE
ADVANTAGE DISADVANTAGE

Instructions are easier to learn


compared to low-level languages

Shorter program - a single instruction


corresponds to many operations at Have to be converted to machine-language
the machine level before they can be executed

Machine-independent - can run on


different types of computers and
operating systems
COMPARISON

You might also like