You are on page 1of 56

COMPUTER PRINCIPLES

FOR PROGRAMMERS
History of Computers and Programming
News of the Week i
Lecture
1. Where are we going?
2. How did we get here?
3. What is Hardware exactly?
4. What is Software exactly?
5. Why do we have all those
programming languages?
Activity
Selection of questions about software concepts.
Choose:
• one from Algorithms and Pseudocode
• one from ICT Past, Present, and Future
• Write 250+ words for each.
There are no right answers, just good arguments.
New Technology: What and How
What to do with new technology? (besides more social media)
• AI, Blockchain, 5G & Smart Cities, Neural Nets, Qubits
• MIT Technology Review, SOSCIP:SDDS AI video editing

How to do new technology?


• Open Source development makes the world a better place
• Linux, Apache, VLC, LibreOffice, Firefox, Android
• Get work experience: contribute to open source
• Ethically Aligned AI, Privacy by Design, Toronto Declaration
Sequence the Tech Revolutions
? 1st 2nd 3rd 4th ?
? Information
? Mass Media
? Scientific
? Industrial
Historic Sequence of Tech Revolutions
mid-15thCE Gutenberg’s movable type (Bible, 1455)
1 Information mid-16thCE 150 – 200 million books in print
Reading and writing became the enabling skills to change one's life

16thCE pamphlets from presses in most towns


2 Mass Media
(from few to many)
17thCE newspapers all over world, advert. supported
Letters to editor, classifieds were Web 2.0

17th and 18thCE arose from exchange of knowledge


3 Scientific Schools and universities brought people together to create new
ideas and applied science. Scientific method – a result of Mass Media.

19thCE Science grew engineering ↓cost ↑supply


4 Industrial Mass Media ↑demand 20thCE computers ↑speed

5 Personal Media 20thCE communications (5B km fibre cable) enabled…


(from many to few) 21stCE connectivity fueled exponential Internet growth
Impact of Revolutions 5. Global ICT

on Western culture
4.
3.1
3.
1. Information

Computers
4.2
2. Mass Media
4.1 Global Industrial
History of Discovery
History of Invention
“But what ... is it good for?”

Engineer at the Advanced Computing Systems Division of IBM


commenting on the microchip in 1968.
NACA (NASA) High Speed Flight Station Computer Room (1949)
ENIAC (Electronic Numerical Integrator And Computer) 1946
Early
Comp
uters
Packaged
for PC
interface
ENIAC on a
ENIAC 1948 chip 1996
1960s
IBM 360
mainframe
CPU & RAM
were in
the main
frame
Large Systems & Special Purpose Devices
Evelyn Berezin, computer engineer
• 1951 – computer logic designer
• 1962 – United Airlines reservation
system: 60 cities,
1 sec. response time; Berezin
designed central system: no failures
in 11 years of operation
• 1971 – first word processor; IC Evelyn at the 'Data Secretary'
chips/system designed by Berezin the first word processor
(notice the screen's portrait orientation)
• Nine patents 1959 – 1969
Mainframes, minis, and midrange

IBM Power
midrange

DEC PDP-11/70
minicomputer Google search,
PayPal, big data &
1970s 4MB RAM
analytics.
Clouds: Tencent,
Google, MS Azure,
IBM z16 (2022), 200 cores, 40TB RAIM, AI on CPU. Alibaba
Mainframes run 68% of the world’s production workloads at 6% of total IT costs
IBM "Investment Protection": backward compatibility with previous platforms
IBM PC Model 5150 & VisiCalc

The first business microcomputer


VisiCalc, the first "killer application"
in 1981 cost $6,600 with printer;
$20,000 in 2022 constant dollars.
Hardware range
From cloud clusters, to mainframes and servers, to PCs,
GPUs, tablets, smartphones, and smart watches down to
Raspberry Pi and Arduino processors…
What do you need?
The Good News: there are a LOT of options.
The Bad News: there are a LOT of options.
Short history of Programming Languages
First computer program, a “diagram of development”,
was written by Ada Lovelace in 1842
calculating Bernoulli numbers
as a demo for Charles Babbage’s Analytical Engine.

See Note G in
"Sketch of The Analytical Engine, with notes upon the Memoir by th
e Translator"
. Switzerland
Ada's 1842 algorithm had the essential
elements of programming languages

Variables Variables Indication of Statement Data Working Variables Result


Nature of Operation

acted receiving change on of Results Variables


upon the value on
results any Variable
Number of
Operation
…and the same Control Structures

Indication of change Here follows a


in value: Selection repetition of
Number of Logic Operations 13 – 25:
Operation: Iteration Logic
Sequential IF weather = cold
Logic THEN wear boots FOR EACH
ELSE side {Left, Right}
put on IF weather = hot put foot into
socks THEN wear sandals footware
then ELSE
shoes wear shoes
1940s – 50s 1st Generation programming
• 1GL – First Generation
machine instructions
• Physical programming:
• Mechanical computing machines
• Binary switches
• Jumper wires on plug-boards connecting
input data to sub-processors to output
– similar to programming the ENIAC
• Handle was used to change programs

• Digital programming on the bare metal:


• Electronic (transistorized) machines
• No operating system
• Programmer used binary codes for hardware instructions
and calculated memory addresses
1950s – 60s 2nd Generation programming
• 2GL – Second Generation Language:
digital programming with symbols
• Assembly language instructions
• Abstracted the 1GL elements away from the hardware
implementation into symbols.
• Move 97 to the AL register (memory location),
binary machine code & Assembly
• 10110000 01100001
• MOV AL, 61h ; Load AL with 97 decimal (61 hex)

• Invented by Kathleen Booth, here doing 1GL


programming showing why she created Assembly
• Assembly was converted into binary code by an
"assembler" specific to the machine
1960s… 3rd Generation programming
3GL – designed for humans, not machines.
• easier to read, write, and maintain applications
• Logical commands, not machine instructions
• Structured programming (Ada Lovelace got us started)
• Multiple types of input / output: interactive UI, files, database
• Machine-independence: same programs on new hardware
• Compilers (Grace Hopper, 1959) translated code to machine
instructions making programs portable across platforms.
Programming in 1940s to 1960s invented
0 GL
ENIAC Six invented for 1|2|3GL:
Ada Lovelace
• modular programs, subroutines
1GL
• language structures, instruction sets
ENIAC Six
• variables, merge & sort, binary trees
2GL
• breakpoints & debugging
Kathleen Booth
2GL: abstraction from hardware 3GL
3GL: compilers Grace Hopper
With logic,
comes bugs.
The operators of
the Mark II Aiken
Relay Calculator
noted they had
found a real bug.
Google Doodle on Grace Hopper's 107th birthday
Dr. Grace Hopper
observed that they
had “debugged”
the machine.
The Mothers of Programming
ENIAC Six Dr.
Frances Bilas Spence, Jean Jennings Bartik,
Kathleen McNulty Mauchly Antonelli,
Kathleen
Frances Snyder Holberton, Marlyn Wescoff Meltzer, Booth
Ruth Lichterman Teitelbaum 1922 –
2022

Ada Lovelace
1815 – 1852
Dr. Grace Hopper
1906 – 1992
The First Software Engineer
Margaret Hamilton
lead software engineer
on Project Apollo
1965 – 1972
Designed Apollo
Guidance Computer to
run tasks by real-time
priority instead of
expected sequence.
Hamilton with all the
AGC program listings.
She is 5'6" 168cm tall.
How many women in ICT?
https://www.menti.com/h6mte2hj1t
A. <17%
B. 17% - 24%
C. 25% - 26%
D. 27% - 29%
E. 30%
F. >30%
Programming: from brain to binary
• Programming is for humans. Coding is for computers.
• Use comments so the humans understand the code.
• The human mind, as it turns out, is messy. — Ellen Ullman, Life in Code
• Programming is
• Analysis to understand the problem
• Creating an algorithm (logical steps) to solve the problem
• Implementing the algorithm in a programming language, i.e. code
• "the art of algorithm design and the craft of debugging errant code."
— Ellen Ullman, Life in Code
1960s… 3GL Programming Languages
• COBOL (1959) COmmon Business - Oriented Language
• Code compiled into platform instructions (Grace Hopper)
• OLTP processing, efficient I/O, decimal arithmetic
• 70% of all business transactions, 43% banking systems
• 220B lines of COBOL extant, +1.5B new lines / year
IDENTIFICATION DIVISION.
PROGRAM-ID. SHOOT_FOOT.
PROCEDURE DIVISION.
* shoot self in foot
SUBTRACT FOOT FROM LEG GIVING CRUTCH.
STOP RUN.
1970s… 3GL Structured Programming
Control Structures: { scope } instead of GOTO / label
• C (Kernighan & Ritchie, 1978. The C Programming Language )

IF (true) { IF (false) GOTO false1 FOR (i = 0; i < 5; i++)


shoot(footL); shoot(footL) // TRUE { shoot(toe[i]); }
} GOTO bypass1 i = 1
ELSE { :false1: :loop1:
shoot(footR); shoot(footR) IF (i > 5) GOTO loop1end
} :bypass1: shoot(toe[i])
i = i + 1
GOTO loop1
:loop1end:
1980s… 3GL Object Oriented Programming
language standards, libraries, data I/O via databases.
• From monolithic C and COBOL from PlayDoh
to Object Oriented programming to Lego
• CLU (Barbara Liskov, 1975) precursor to OOP
• Smalltalk (Adele Goldberg, Diana Merry, Alan Kay 1980)
• C++ (Bjarne Stroustrup, 1985. "be-AR-ne STROV-stroop"

The C++ Programming Language)


1990s… 3GL Event Driven GUI Programming
More powerful PCs, the Internet via browsers made
GUIs the new normal in Operating Systems and applications
oVisual Basic (1991) – OOPish with UI objects, GUI layout tools
o VB is derided among 'real' programmers, and rightly so.

oPython (1991) – readable, open sourced, scalable, extensible


oJava (1995) – "write once, run anywhere“, compiled to bytecode
o Java Virtual Machine runs bytecode on various platforms for portability

oJavaScript (1995) – runs in browser and in Node.js server side


o N.B. TypeScript (2012) – statically typed JS for scalability and reliability
2000s… 3GL better, bigger, faster, safer
Object Oriented & event driven programming is mainstream
o C# (Microsoft, 2001) Inherits from Java and C++
.NET Core is open-source, general-purpose, cross platform 
o Windows PowerShell (2006), PowerShell Core (2016) for scripting
Object based command line and scripting language.
PS Core is cross platform for Windows, Linux, Mac, and ARM

2010+: mobile and tablets (Android=Java), no-SQL DB,


safe by design (Rust), parallel programming (GPUs),
big data (Hadoop + Java / Python).
oSee octoverse, GitHub, TIOBE, PYPL, StackOverflow for
language popularity
4GL Programming Languages
• Relational Database Management Systems (RDBMS)
• SQL (Structured Query Language: data storage & retrieval)
• RDBMS & SQL developed at IBM in 1970s.
• In the late 80s & 90s, when servers became more powerful,
DB & SQL began to replace indexed files.
• Learn to program Scratch

LOGO
5+GL Programming Languages 
• low-code
4GL with GUI
• flows from design
to modeling the
architecture
to adding 3GL logic
to deployment
• no-code is LOGO, Scratch for adults
History of Computers and Programming

There are two types of


programming languages:
The ones people complain about
and the ones nobody uses.
Programming Architectures
• Interpreted vs Hybrid vs Compiled
• High vs Low level
• General purpose vs domain-specific
• Bad code can be written in any language

Read the following slides before


doing today's activity and next week's quiz.
Programming Architectures
Platform = Operating System (OS) + hardware Interpreted Hybrid Compiled
Command Line Interpreter:  
High level, Domain-Specific Languages  
OS cmds, Unix shell scripts,
• execute inside a host application or OS shell MS PowerShell Core
• dynamically typed (alpha or numeric data) Browser/node.js JavaScript
• Scripting interpreted at run-time, not compiled RDBMS: SQL (4GL)
MS Office: VBApp (3GL)
High level, General Purpose Languages (3GL) Java, C# C
Python – hinted
• execute on the OS
• Data Typing: hinted, dynamic, or strong JavaScript – dynamic Python C++
• Interpreted & Hybrid need run-time enviro. TypeScript – strong .NET COBOL
Low level, General Purpose Languages (2,3GL) Assembly
• run 'on the bare metal' of a chip architecture
  C
• strongly typed
• used to create OS, device drivers, compilers,
  C++
virtual machines, Hybrid run-time enviros Rust
Python hybrid vs C++ compiled

projected
−0.232 seconds
loop time
3GL Programming Languages
FORTRAN (IBM, 1954) FORmula TRANslation
First widely used high-level, general purpose, language
Continues to be up-to-date (Object Oriented, parallel computing)
Widely used for computationally intensive tasks, high-
performance computing, benchmarking supercomputers.
! Fortran 2018 is latest version
program shootFoot ! Classic programmer joke
print *,'Shoot extremity...19 times out of 20'
end program shootFoot
Short history of Programming Languages (read L8R)
1970s: structured programming with subroutines, code blocks, and control patterns. GOTO was outlawed but it
took until the 1980s to go away.
• C (Kernighan & Ritchie, 1978. The C Programming Language aka K&R)
• The first portable systems programming language; created to rewrite UNIX.

1980s: standards, consolidation, modules, performance, RDBMS.


• From monolithic C and COBOL to modular and Object Oriented programming
• C++ (Bjarne Stroustrup, "be-AR-ne Strov-stroop" 1985. The C++ Programming Language)
 C with OO improved Systems Programming (OS) & high-performance applications.
 Classes unified data & logic into objects that have their own state and behaviour.
Objects know things about themselves and can act upon what they know.
• Relational Database Management Systems (RDBMS)
• SQL (Structured Query Language: data storage & retrieval) 4GL
• Data could now take care of itself without explicit programming
• RDBMS and SQL set up and enforced the rules for data usage which all programs had to obey
High vs Low Level Programming Languages
• Platform = OS + hardware
• Low-Level: runs directly on the hardware, the "bare metal".
• operating systems and device drivers for specific hardware.
e.g. Assembly, C, C++ running directly on x86 architecture, not the
OS
• High-Level: run on the OS using services of Low-Level code
allowing programming to be independent of the "bare metal"
• e.g. user-facing applications using OS services for I/O and files
C & C++ for high performance applications such as games, MS Office
apps. Python for general purpose.
Types of Programming Languages
• Interpreted/Scripting Languages: line-by-line execution of source code.
Not compiled. Little pre-runtime translation. Slower but flexible and
reactive. Variables dynamically typed at run time.
• Domain-Specific Languages exist inside an application.
• Web servers process JavaScript commands embedded in a dynamic HTML file before
generated HTML is sent to client (browser). JavaScript is run in the browser from JS cmds inside
the HTML. VBA (Visual Basic for Applications) is run inside MS Office apps.
• Command Language Interpreter (CLI) (or a shell that runs scripts)
MS-PowerShell, *nix Bash, IBM z Job Control Language, IBM i Control Language
• Data-Oriented Languages (like SQL) designed for management of data in relational databases.
SQL has 4GL declarative commands; an SQL 'stored procedure' is like a 3GL programming
language only within an RDBMS environment. (Relational Data Base Management System,
often just "DB").
Types of Programming Languages
• Compiled Languages: translators generate machine
specific instructions from source code.
E.g. C, C++ are compiled. Fast but less flexible than
interpreted languages. Variables statically typed: data
types declared by programmer.
• Hybrid Languages: first compiled into platform-neutral
bytecode and then interpreted by a virtual machine
for the local platform. E.g. Java, C#, and Python.
Notes
What follows will not be on the quiz but it is worth your
attention. It is here to provide more background and depth
to today's topics.
from Hello World to Shoot Foot
// C++
#include <iostream>
int main() {
std::cout << "C++ makes it harder to shoot yourself in the foot than ";
std::cout << "with C but, when you do, you blow your whole leg off.";
return 0; /* Bjarne Stroustrup "be-AR-ne Strov-stroop" */
}

-- SQL
CREATE TABLE helloworld (word1 TEXT, word2 TEXT); -- Data Definition
INSERT INTO helloworld VALUES ("Shoot","Foot"); -- Data Manipulation
SELECT * FROM helloworld WHERE word1 = "Shoot"; -- Data Query

Shoot|Foot  output
from Hello World to Shoot Foot
# Python
print "Shoot foot!" # you can see why people like this at first
for part in body: # but it's just another programming language
if part == foot: # with COLON TAB instead of {braces}
gun.shoot(part) # OOP and oops: shot both feet
// Java
System.out.println( gun.shoot( body.getFoot() )));
// C#
Console.WriteLine ( gun.shoot( body.getFoot() ))); // Java and C++

// JavaScript // can shoot one's foot in ways too numerous to mention


alert('Google now knows of your interest in Foot Shooting');
<?php if (http_response_code() != 404) { echo "Shoot foot!"; } ?>
Types of Programming Languages (Cont’d)
• Dan Bricklin, how he invented the first “killer app”
• eLearning: Exploring Languages
• eLearning: Compiled vs Interpreted
• Don't take the bait to click to the newer version of these
courses, it will waste your time.
• eLearning Tutorials Login needs your Seneca credentials
and a LinkedIn account since LinkedIn bought Lynda
The Art of Computer Programming
"computer programming is an art, because it applies
accumulated knowledge to the world, because it requires
skill and ingenuity, and especially because it produces
objects of beauty. A programmer who subconsciously views
himself as an artist will enjoy what he does and will do it
better."
• Donald E. Knuth, winner of 1974 Turing Award informally
considered the Nobel Prize of computer science.
• The Art of Computer Programming is a classic.
Types of Non-Programming Languages
“Languages” which are not programming languages:
• HTML: HyperText Markup Language for the Web
• <P>Paragraph<B>text</B></P> browser formats/renders
• CSS: Cascading Style Sheets
• separate presentation style and appearance from content
(font, size, colours for a DOM object e.g. a paragraph)
• XML: eXtensible Markup Language
• Document and data encoding markup language
• E.g. for data structures used in web services
Charles Babbage's
Difference Engine No. 2
•simpler than his Analytical Engine
•8,000 parts •5 tons •11 feet long
With logic,
comes bugs.
The operators of
the Mark II Aiken
Relay Calculator
noted they had
found a real bug.

Dr. Grace Hopper


observed that they
had “debugged”
the machine.
Glossary of Hardware Devices
• Computer hardware is what you can physically touch. Hardware devices are
physical parts of a computer system.
• Internal hardware devices reside inside the computer case like a Motherboard and
NIC. External or Peripheral Devices plug into a computer system to add
functionality, e.g. mouse, keyboard, screen, USB and optical drives.
• Processing hardware devices: CPU, ALU, FPU, and GPU.
Input devices: Keyboard, Microphone, Mouse, touch screen, stylus, camera and
scanner.
Output devices: Monitor, Printer, Speaker, and Plotter. Haptic feedback
Input / Output devices: RAM, HDD, SSD, other storage devices.
56

Glossary: what do we mean by Algorithm, Code, and Programming?


• Computer Programming: a process that leads from an original
formulation of a problem to executable computer programs.
• Algorithm: a self-contained step-by-step set of operations that solve a
problem.
• Code: a set of instructions programmed into a computer to perform an
Algorithm.
• Computer Program: sets of code that tell a computer what to do,
written in one or more Programming Languages, contained as a
Source Code in a text file, compiled into Machine Code, and executed
by CPU.

You might also like