Lecture 1
Lecture 1
Lecture # 01
Muhammad Farhan
Department of Computer Science
COMSATS University Islamabad,
Lahore Campus
[email protected]
System software
Application Software
How?
Through a sequence of very clear and defined steps (algorithm) using a
specific language (programming language) that aim to solve the problem
Algorithms are not only used for computer programming, they are
a general concept for problem solving
Programming Languages
Programming languages are used in computer
programming to implement algorithms.
(HIGH) (HIGH) SQL,
(LOW) Machine (LOW)
Language Visual Basic, C, CSS, Haskell
Code Assembly Code python etc. etc.
Machine, Assembly and High
Level Language
Three types of programming languages
1. Machine languages
Strings of numbers giving machine specific instructions. Programs
written in machine language consist of entirely of 1s and 0s
Example:
00101010 000000000001 000000000010
10011001 000000000010 000000000011
2. Assembly languages
English-like abbreviations representing elementary computer operations
(translated via assemblers)
Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
Machine, Assembly and High
Level Language
3. High-level languages
Codes similar to everyday English
Translated via compilers
Example:
grossPay = basePay + overTimePay
Print “Your total pay is ” grossPay
Compilers vs. Interpreters
Compilers
Compile several machine instructions into short sequences to simulate
the activity requested by a single high-level primitive
Produce a machine-language copy of a program that would be
executed later
Convert source code into object code
Interpreters
Execute the instructions as they were translated
Source Code vs Object Code
Source code is the list of human-readable
instructions that a programmer writes
Object code is the output of a compiler after it
processes source code.
Programming (Revisited)
A way to solve problems using a computer
Implementation phase
Problem solving and Implementation
A programming task can be divided into two
phases:
1. Problem solving
Define : Clearly describe a problem
Design its solution (Algorithm): Produce an
ordered sequence of steps that describe solution to the
problem;
2. Implementation phase
Implement the program in some programming
language
write code, compile, link, Test & Debug
Problem solving and Implementation
Defining a Problem:
Break the definition of the problem down into
manageable steps. Example; input, Processing, Output
Program: Write a program which tells whether the
temperature entered by user in below freezing point or
not?
• Pseudo Code
Pseudocode is an informal high- level description of
the operating principle of a computer program or
other algorithm
• Flowchart
A flowchart is a type of diagram that represents a
workflow or process.
Pseudo Code (Example)
Example: The following set of instructions forms a
detailed algorithm in pseudo-code calculate the pay
of a person.
Begin
Input the three values into the variables Name, Hours, Rate.
Calculate Pay = Hours * Rate.
Display Name and Pay.
End
Flowcharts (Example)
Programming Languages
(Revisited)
Programming languages are used in computer
programming to implement algorithms.
• Embedded Systems
• Communication Systems
ANSI C
Tools of the trade
Editor
Interpreter and Compilers
Debuggers
Integrated Development Environment
(IDE)
It contains
Editor
Compilers
Debugger
Linkers
Loaders
C Program Development Environment
Program is created in the editor
Editor Disk
and stored on disk.
Preprocessor program
Preprocessor Disk processes the code.
Compiler creates object
Compiler Disk code and stores
it on disk.
Linker Disk Linker links the object
code with the libraries
Primary Memory
Loader
Loader puts program in
Disk ..
memory.
..
..