CS101 Lecture 01 - Introduction To Computers & Programming
CS101 Lecture 01 - Introduction To Computers & Programming
PROGRAMMING
Lecture 1 (online)
Introduction to Computers & Programming
Week 20-24 April 2020
Zoubeir Aungnoo
Lecture Aims
■ Definition of computer
■ What is Programming?
■ History and type of programming languages
Computers
■ A digital computer is an electronic programmable machine that can process
almost all kinds of data.
– A computer system: hardware + software.
■ Processes information according to instructions (software) given. Without
these instructions it doesn’t know what to do.
■ Instructions you give: called a program
■ Programming is the systematic way of writing computer programs
■ Most people are users of computer programs! Not everyone writes program.
■ Users vs Programmers
■ Users often want to do things with computers which haven’t been done
before, and since we programmers get paid to do that, we are going to learn
how to program.
Why learn programming?
■ .
Why learn programming?
■ .
Types of computer programs
2. Application Software:
I. General purpose software (off the shelf, tailor made software)
II. Custom made (bespoke software)
Types of computer programs
This three steps procedure can be repeated many times if desired, to process
large quantity of data.
Note: these steps can be lengthy and complicated.
Programming & Programming
Languages
Overview
■ Programming is an Art. Watch ‘The Codebreakers’ – shows how the first
programmable computer, Colossus, was used to break the Enigma code.
■ Think of a programmer as a bit like a plumber!
Programming & Programming
Languages
Once we have our algorithm in place; need to express our program in a
form that the computer can work with.
There are a variety of computer languages and the one that is chosen for a
particular depends on the job that is being done. One way of characterizing
them is by ‘generation’.
Scripting Language
Machine Language – 1st Generation
Disadvantages:
1. Machine specific – program written for one type of machine won’t run on
another.
Machine Language – 1st Generation
Disadvantages
2. Time consuming, laborious and cumbersome to work with.
3. Error prone.
4. Debugging is tedious.
Assembly Language – 2nd Generation
Advantage:
1. Easier for programmer to use – debugging is easier.
Assembly Language – 2nd Generation
■ Disadvantages:
1. Needs to be translated to machine code.
2. Machine specific.
■ Advantages:
1. Independent of computer architecture
2. Simple instructions similar to English - easier to program with.
3. Debugging is not a hassle anymore!
History– 3nd Generation
Scripting Languages
■ Converts program into machine code for the computer to understand and
execute.
■ 3 Types:
1. Assembler
2. Compiler
3. Interpreter
Translation Programs
Assembler
Translates assembly language into machine code.
Translation is easy because one instruction in assembly language
corresponds to one machine code instruction.
Compiler
Converts the whole of a program written in high level language into
machine code in one go.
The programmer’s code is known as source code and the compiled code is
known as object code.
Object code is used each time the program is run, i.e. no recompilation
needed.
Translation Programs
Compiler
■ If the program is altered, the original source code is altered and re
compiled. Large programs takes quite a long time to compile.
Interpreter
■ Also translates source code into object code but
■ Difference is that the interpreter translates one line at a time, executes it and
then proceed to the next.
■ No object code produced, so the program has to be interpreted each time it
is run.
Translation Programs