What is Programming?
Joel Ross
IMT 511
Which product is the most dangerous?
Should we do this by hand?
Slow
Tedious
Error-prone
How to scale?
How to reproduce?
Solution: get someone else to do the boring work for us!
World's greatest assistant!
Our new assistant
We need to tell the computer what to do!
Problem
Computers don't
speak English!
Programming
Writing instructions for a computer in a language it understands
First Programmer:
Ada Lovelace (1815-1852)
Charles Babbage's Analytical Engine (designed 1837; never built)
Binary
Example from David Chiu. Disclaimer: Fake example!
LOAD Contents of A
LOAD Contents of B
LOAD Contents of C
MULTIPLY C and 4 and STORE in TMP
SUBTRACT TMP from B and STORE in TMP
ADD A to TEMP and STORE in TEMP
STORE TEMP in D
# Write this instead #
LOAD A
LOAD B
LOAD C
MULTIPLY C and 4 and STORE in TMP
SUBTRACT TMP from B and STORE in TMP
ADD A to TEMP and STORE in TEMP
STORE TEMP in D
Have a computer program (an Interpreter) do a
find-and-replace to change
LOAD
to 010101
, etc.
# Write this instead #
LOAD A
LOAD B
LOAD C
MULTIPLY C and 4 and STORE in TMP
SUBTRACT TMP from B and STORE in TMP
ADD A to TEMP and STORE in TEMP
STORE TEMP in D
A
B
C * 4
TMP
C
B - (C * 4)
TMP
B - (TMP)
A + (TMP)
A + B - (C * 4)
TMP
D
Abstraction
The process of generalization; of working with higher-level representations rather than specific details
A necessary skill when programming
Programming Language
A language that a human can write, and which can be interpreted by a computer
(A formal language, not a natural one)
Example Code
# This is the programming language Python
# It means something reasonable, I swear!
import math
def roots(a, b, c):
det = math.sqrt(b * b - 4 * a * c)
x1 = (-b + det)/(2 * a)
x2 = (-b - det)/(2 * a)
return (x1, x2)
x = roots(1, 5, -14)
print(x)
# Any idea what this program does?
Managing Code
Course Objective
Learn to give instructions to computers so they do the boring stuff!
Algorithm
A set of step-by-step instructions for solving a problem.
Needs to be unambiguous, executable, and terminating
Programming involves a lot of failure and frustration
It's not your fault, and we are here to support you!
If you are stuck for >30 minutes,
ask for help!
If you are lost, ask for help!
If you get frustrated, ask for help!
imt511-what-is-programming
By Joel Ross
imt511-what-is-programming
- 621