COMP-111
Programming Fundamentals
1
About the instructor
• Dr. Saad Qayyum
• 2005 – BS (Computer Engineering) – COMSATS Abbottabad
• 2007 – MS (Microelectronics Systems Design) – University of Southampton, UK
• 2019 – PhD (Electrical Engineering) – RWTH Aachen University, Germany
• Research Interests:
• Embedded Systems
• Circuit design for wireless and wireline communications
• Circuit Design for biomedical systems
About the Course
• Course Title: Programming Fundamentals
• Course Code: COMP-111
• Credit Hours: 3
• Text Book:
– C++ Programming by Deitel and Deitel, 10th Edition (2017)
• Consultation Hours:
– Section 1: Tuesday 3 pm to 4 pm
– Section 2: Thursday 3 pm to 4 pm
Lecture 1 Lecture Objectives
In this lecture, you will learn about:
• The sinusoidal teaching philosophy
• The need of programming
• Introduction to Scratch programming
environment
Lecture 1 Contents
1.1 Teaching Philosophy
1.2 Problem Solving using Machines
1.3 What is a Computer System?
1.4 Programming Languages
1.5 Summary
Lecture 1 Contents
1.1 Teaching Philosophy
1.2 Problem Solving using Machines
1.3 What is a Computer System?
1.4 Programming Languages
1.5 Summary
Lecture 1 1.1 Teaching Philosophy
• Two important tips
• Break the glass
• The missing link. But it’s never too late
• Sinusoidal teaching philosophy
• Think big
• Slide down to the basic level
• Ramp up to where we looked in the beginning
This course will enable you to …
Lecture 1 Contents
1.1 Teaching Philosophy
1.2 Problem Solving using Machines
1.3 What is a Computer System?
1.4 Programming Languages
1.5 Summary
Lecture 1 1.2 Problem solving using machines
Figure: Programming used to solve problem
Lecture 1 Contents
1.1 Teaching Philosophy
1.2 Problem Solving using Machines
1.3 What is a Computer System?
1.4 Programming Languages
1.5 Summary
Lecture 1 1.3 What is a Computer System
Components of a Computer System
• Hardware: physical parts of the
programmable machine
• Software: set of instructions to make
it do something. Also called a
program. The program may make
the computer act smart or dumb
• Programmer: person who writes
instructions (programs) to make
computer perform a task as solution
to a problem.
Lecture 1 1.3 What is a Computer System
Hardware
• A basic computer consists of 4 basic components:
(Central Processing Unit)
Input Output
devices devices
Memory
Figure: Computer hardware components
_____________________________________________________________________________________________________________________________________
1
https://en.wikiversity.org/wiki/Hardware#/media/File:Computer2.png
Lecture 1 1.3 What is a Computer System
Software
Figure: The general process to solve a problem using computer
_____________________________________________________________________________________________________________________________________
https://upload.wikimedia.org/wikipedia/commons/e/e9/Programming.png
Lecture 1 1.3 What is a Computer System
Data, information and instructions
Memory organized as follows:
Information is stored in bits or binary digits.
Bit: Smallest piece of memory with values 0 (off, false) or 1
(on, true)
Byte: 8 consecutive bits. Bytes have addresses.
The number 149 is stored in the byte (10010101) with the
address 16, and the number 72 (01001000) is stored at
address 23.
Lecture 1 Contents
1.1 Teaching Philosophy
1.2 Problem Solving using Machines
1.3 What is a Computer System?
1.4 Programming Languages
1.5 Summary
Lecture 1 1.4 Programming Languages
Introduction
A program may be written in various programming languages,
some directly understandable by computer and others requiring
intermediate translation steps.
We start with an algorithm, which is a set of well-defined steps.
Example: Step 1: Determine the first number; call it A
Algorithm for Step 2: Determine the second number; call it B
calculating the Step 3: Determine the third number; call it C
average of 3 Step 4: Find the sum of A,B and C; call it X
numbers. Step 5: Divide X by 3; call it the RESULT
Step 6: Present the RESULT
_____________________________________________________________________________________________________________________________________
1
Deitel, H.M. and Deitel, P.J (2013). C How to Program 7/E. United State of America: Pearson Education.
Lecture 1 1.4 Programming Languages
Figure: Hierarchy of programming languages 1
_____________________________________________________________________________________________________________________________________
1
http://3.bp.blogspot.com/-btpK1XKZbWo/T9FBqYz3bjI/AAAAAAAABKA/qGt4MDRu0T8/s1600/level+of+programming+language.png
Lecture 1 1.4 Programming Languages
• Phases (2) to (4) are often performed by a single command or
button click.
• Errors detected at any step will prevent execution of following
steps.
Source Code Object Code
Preprocessor Compiler Linker
Phase 2: Phase 3: Phase 4:
Modified Executable
Source Code Code
Figure: Steps in producing an executable code
Lecture 1 1.4 Programming Languages
Program Development Environment
• A programming system generally consists of following parts:
o A development environment called IDE
o The standard library
Lecture 1 1.4 Programming Languages
Integrated Development Environments (IDEs)
An IDE, combines all the tools
needed to write, compile, and
debug a program into a single
software application.
Examples: Dev C++, Microsoft
Visual C++, Borland C++
Builder, CodeWarrior, etc. Figure: Integrated Development
Environments (IDE)
____________________________________________________________________________________________________________________________________
1
http://theteacher.info/websites/gcse_comp/WebPages/A451_CompSys/217_Programming/ProgLang/f/f.html
Lecture 1 1.4 Programming Languages
Figure: Example of IDE using Borland C++
Lecture 1 1.4 Programming Languages
Scratch Programming Environment
• A drag and drop programming environment
o Developed at MIT: https://scratch.mit.edu
• Installed using an executable or online (requires internet)
• You may
o Write new programs from scratch
o Edit existing projects according to your needs
• Example projects
Lecture 1 Contents
1.1 Teaching Philosophy
1.2 Problem Solving using Machines
1.3 What is a Computer System?
1.4 Programming Languages
1.5 Summary
Lecture 1 1.5 Summary
In this lecture, you have learnt:
• About basic computer concepts, hardware and
software components for program development.
• A programmer uses programming languages to write a
program rather than coding in machine language.
• Scratch programming environment.
____________________________________________________________________________________________________________________________________ (2013). C How to Program 7/E. United
State of America: Pearson Education, Inc., publishing as Prentice Hall
Lecture 1
Self-Review
Lecture 1 Self-Review
Exercise: Fill in the blanks.
a) Computers process data under the control of sequences of
instructions called computer __________.
b) __________ languages are most convenient to programmer
for writing a program quickly and easily.
c) The only language a computer can directly understand is
_________.
d) Computer programs are normally typed using a(n)
__________ program.
_______________________________________________________________________________________________________________________
___________________________________________________________________________________________________________________* Paul, D. and Harvey, D. (2013). C How to Program 7/E.
I
Deitel, H.M. and Deitel, P.JUnited
(2013).State
C Howof America: Pearson
to Program Education,
7/E. United StateInc., publishing
of America: as Prentice
Pearson Hall
Education.
Lecture 1 Self-Review
e) The ______________ translates a(n)_______________
language program into a machine language program.
f) A(n) ______________provides access to the
programmer for editing, compiling, and so on.
g) Before linking, a machine language program is saved on
the disk as a(n) ___________ file.
h) After linking, a machine language program is saved on
disk as a(n) ___________ file.