You are on page 1of 39

Computer

Programming
Lecture 1
Introduction To Computer
Programming

Mr. Abbas kh. Ibrahim


Welcome to
(Computer Programming for
Petroleum Engineering 2020)
Course Info

Instructor: Abbas Khaleel Ibrahim abbas.ibrahim@uoz.edu.krd


TA: Mr. Tahir (Computer Lab.)

Introduction to Computer Programming with MATLAB

Class Hours

Office: Petroleum Engineering Dept.


Objectives
 Introduces the student to the world of programming
through MATLAB to develop scientific and engineering
models.

 The student will be able to read, understand and write


beginner level programs using MATLAB.

 The student will be able to solve mathematical and


Petroleum Engineering problems using MATLAB.
COURSE OUTLINE

 Introduction.
 MATLAB Syntax and Commands.
 Use of MATLAB to Solve Engineering Problems.
 Algorithms.
 Conditional Statement.
 Repetition Loops.
 Subprograms.
 Matrix Manipulation.
 File I/O.
GRADING

We’ll discuss that later !


History of Computing
1800S
 George Boole – devised Boolean
algebra

 Charles Babbage – created "analytical


engine“

 Augusta Ada Byron – first computer


programmer

 Herman Hollerith – founder of


company that would become IBM
1930S
 Alan Turing – deciphered German
code in WWII; father of artificial
intelligence
 John V. Atanasoff – inventor of first
electronic digital special purpose
computer
1940S
 Howard Aiken – built large scale
digital computer, Mark I

 Grace M. Hopper – originated term


"debugging"; pioneered development
and use of COBOL

 John Mauchley and J. Presper


Eckert – built first large scale
general purpose computer, ENIAC
1940S CONTINUED
 John von Neumann – developed
stored program concept

 Maurice V. Wilkes – built EDSAC,


first computer to use stored program
concept

 John Bardeen, Walter Brattain,


and William Shockley – developed
transistor that replaced vacuum
tubes
1950S
 John Backus – created Fortran;
early user of interpreters and
compilers

 Reynold B. Johnson – invented the


disk drive

 Donald L. Shell – developed


efficient sorting algorithm
1960S
 JohnG. Kemeny and
Thomas E. Kurtz – invented
BASIC

 Corrado Bohm and Guiseppe


Jacopini – proved that any
program can be written with
only 3 structures: sequence,
decision, and loops

 Edsger W. Dijkstra –
stimulated move to structured
programming by declaring
"GOTO" harmful
1960S CONTINUED
 Harlan B. Mills – advocated
use of structured programming

 Donald E. Knuth – wrote


definitive work on algorithms.

 Ted Hoff, Stan Mazer,


Robert Noyce, and Frederico
Faggin – developed first
microprocessor
1960S CONTINUED
 Douglas Engelbart – invented computer mouse
1970S
 Ted Codd - software architect;
laid the groundwork for
relational databases

 PaulAllen and Bill Gates -


cofounders of Microsoft
Corporation

 StephenWozniak and
Stephen Jobs - cofounders of
Apple Computer Inc.

 Dan Bricklin and Dan


Fylstra - wrote VisiCalc, the
first electronic spreadsheet
program
1970S CONTINUED
 Dennis Ritchie - creator of the
C programming language.

 KenThompson - created the


Unix operating system

 Alan Kay – developer of


Smalltalk, a pure object-
oriented language

 Don Chamberlain - created a


database programming
language, later known as SQL,
1980S
 Phillip“Don” Estridge - at
IBM directly responsible for
the success of the personal
computer.

 MitchellD. Kapor -
cofounder of Lotus
Corporation

 Tom Button - group product


manager for applications
programmability at
Microsoft;
 headed the team that
developed QuickBasic, QBasic,
and Visual Basic.
1980S CONTINUED
 Alan Cooper - considered the
father of Visual Basic.

 TimBerners–Lee - father of the


World Wide Web.

 Charles Simonyi - father of


Word.

 BjarneStroustrup - creator of
the C++ programming language.

 Richard M. Stallman - founded


Free Software Foundation
1990S
 Marc Andreessen - inventor of the
Web browser.

 James Gosling – creator of Java.

 Linus Torvalds - developed the


popular Linux operating system.
2000S
 Sergey M. Brin and Lawrence E.
Page – founders of Google

 Mark Zuckerberg – founder of


Facebook.

 Steve Chen, Chad Hurley, and


Jawed Karim – founders of
YouTube.
An Introduction to Computers
and Problem Solving
Representation of the problem solving
process
Problem-solving: approach like algebra class

• How fast is a car traveling if it goes 50 miles in 2


hours?

• Input : two inputs : 50 miles , 2 hours.

• Process: speed = distance/time = 50/2.

• Output: 25 mph (miles per hour).


Program Planning Tips
• Always have a plan before trying to write a
program

• The more complicated the problem, the more


complex the plan must be.

• Planning and testing before coding saves time


coding.
Program development cycle
1. Analyze: Define the problem.

2. Design: Plan the solution to the problem.

3. Choose the interface: Select the objects (text boxes,


buttons, etc.).

4. Code: Translate the algorithm into a programming


language.

5. Test and debug: Locate and remove any errors in the


program.

6. Complete the documentation: Organize all the


materials that describe the program.
What is a Computer?
Computer
– Device capable of performing computations
and making logical decisions
– Computers process data under the control of
sets of instructions called computer program
s
Hardware
– Various devices comprising a computer
– Keyboard, screen, mouse, disks, memory, C
D-ROM, and processing units
Software
– Programs that run on a computer
Computer Organization
Six logical units in every computer:
– Input unit
• Obtains information from input devices (keyboard, m
ouse)
– Output unit
• Outputs information (to screen, to printer, to control
other devices)
– Memory unit
• Rapid access, low capacity, stores input information
– Arithmetic and logic unit (ALU)
• Performs arithmetic calculations and logic decisions
– Central processing unit (CPU)
• Supervises and coordinates the various components o
f the computer
– Secondary storage unit
• Cheap, long-term, high-capacity storage
• Stores inactive programs
Computer Architecture
Common Softwares

 Operating System
 Compilers
 Assemblers
 Interpreters
Evolution of Programming languages
– First Generation : Machine languages
• Strings of numbers giving machine specific instructions
• Example:
+1300042774
+1400593419
+1200274027
– Second Generation : Assembly languages
• English-like abbreviations representing elementary computer operations
(translated via assemblers)
– Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
– Third Generation : High-level languages
• Codes similar to everyday English
• Use mathematical notations (translated via compilers)
• Example: grossPay = basePay + overTimePay
Programming Language
hierarchy
What does the computer
understand?
• Computer only understands machine language
instructions.
Assembler
• Instructions written in assembly language
must be translated to machine language
instructions :
– Assembler does this
• One to one translation : One AL instruction
is mapped to one ML instruction.
• AL instructions are CPU specific.
Compilation into Assembly

Source Assembly
Program Compiler Language

Assembly Machine
Assembler
Language Language
Compiler
• Instructions written in high-level language also
must be translated to machine language
instructions :
– Compiler does this
• Generally one to many translation : One HL
instruction is mapped to many ML instruction.
• HL instructions are not CPU specific but compiler
is.
Compilation

Source Target
Program Compiler Program

Input Target Program Output


Interpreter
• An interpreter translates high-level instructions into an
intermediate form, which it then executes. In contrast, a
compiler translates high-level instructions directly into
machine language.
• Compiled programs generally run faster than interpreted
programs.
• The advantage of an interpreter, however, is that it does
not need to go through the compilation stage during which
machine instructions are generated. This process can be
time-consuming if the program is long. The interpreter, on
the other hand, can immediately execute high-level
programs. For this reason, interpreters are sometimes used
during the development of a program, when a programmer
wants to add small sections at a time and test them quickly.
Interpretation
Source
Program

Interpreter Output

Input

You might also like