0% found this document useful (0 votes)
90 views56 pages

DCIT104 Lecture 2

The document provides an overview of a lecture on computers and programming fundamentals. It discusses how computers have evolved from early electronic circuits using switches to today's microchips containing billions of switches. It describes how computer memory stores instructions and data as binary digits (0s and 1s) and how a processor executes instructions to perform calculations by interacting with memory. It also summarizes the history of programming languages from machine instructions to assembly languages to high-level languages, and the role of assemblers and compilers in translating between the different language levels.

Uploaded by

Muel Opoku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views56 pages

DCIT104 Lecture 2

The document provides an overview of a lecture on computers and programming fundamentals. It discusses how computers have evolved from early electronic circuits using switches to today's microchips containing billions of switches. It describes how computer memory stores instructions and data as binary digits (0s and 1s) and how a processor executes instructions to perform calculations by interacting with memory. It also summarizes the history of programming languages from machine instructions to assembly languages to high-level languages, and the role of assemblers and compilers in translating between the different language levels.

Uploaded by

Muel Opoku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

DCIT 104

PROGRAMMING
FUNDAMENTALS

Lecture 2 – Computers and Programs (General)

Lecturer: Dr. Moses Akazue


Contact Information: [email protected]

College of Education
School of Continuing and Distance Education
2020/2021 – 2022/2023
Session Overview

Just as knowing how a car works "under the hood" has


benefits to a car owner, knowing how a computer
works under the hood has benefits to a programmer.
This section provides a very brief introduction on the
evolution of computing resources, programming
language history, computing careers and
computational thinking.
Session Outline

• Computers and its components


• Programming language history
• Using programming for problem solving
• Computing careers and their potential
• Programming and non-computing jobs
• Precision, Logic and Computational Thinking
Looking into the Bonnet of a Car

Just as knowing how a car works "under the hood" has benefits to a car
owner, knowing how a computer works under the hood has benefits to a
programmer. This section provides a very brief introduction.
Google Confidential and Proprietary
zyBooks
Switches

• When people in the 1800s began using electricity for lights and
machines, they created switches to turn objects on and off.
• A switch controls whether or not electricity flows through a wire.
• In the early 1900s, people created special switches that could be
controlled electronically, rather than by a person moving the switch
up or down.
• In an electronically controlled switch, a positive voltage at the
control input allows electricity to flow, while a zero voltage
prevents the flow.
• Such switches were useful, for example, in routing telephone calls.
• Engineers soon realized they could use electronically controlled
switches to perform simple calculations. Google Confidential and Proprietary
zyBooks
Bits

• The engineers treated a positive voltage as a "1" and a zero voltage


as a "0".
• 0s and 1s are known as bits (binary digits).
• They built connections of switches, known as circuits, to perform
calculations such as multiplying two numbers.

Google Confidential and Proprietary


zyBooks
Early Computers

• These circuits became increasingly complex, leading to the first


electronic computers in the 1930s and 1940s, consisting of about
ten thousand electronic switches and typically occupying entire
rooms as in the above figure.
• Early computers performed thousands of calculations per second,
such as calculating tables of ballistic trajectories.

Google Confidential and Proprietary


zyBooks
Processors

• To support different calculations, circuits called processors were created to


process (aka execute) a list of desired calculations, with each calculation
called an instruction.
• The instructions were specified by configuring external switches, as in the
figure above.
• Processors used to take up entire rooms but today fit on a chip about the size
of a postage stamp, containing millions or even billions of switches.

Google Confidential and Proprietary


zyBooks
Computers Shrunk as Switches Shrunk

• To support different calculations, circuits called processors were created to


process (aka execute) a list of desired calculations, with each calculation
called an instruction.
• The instructions were specified by configuring external switches, as in the
figure above.
• Processors used to take up entire rooms but today fit on a chip about the size
of a postage stamp, containing millions or even billions of switches.
• As switches shrunk, so did computers. The computer processor chip below
has millions of switches.

Google Confidential and Proprietary


zyBooks
Memory

• Instructions are stored in a memory.


• A memory is a circuit that can store 0s and 1s in
each of a series of thousands of addressed
locations, like a series of addressed mailboxes that
each can store an envelope (the 0s and 1s).
• Instructions operate on data, which is also stored in
memory locations as 0s and 1s.
• Thus, a computer is basically a processor
interacting with a memory, as depicted in the
following example.

Google Confidential and Proprietary


zyBooks
Computer Processor and Memory

• In the example, a computer's processor executes program


instructions stored in memory, also using the memory to store
temporary results.
• The example program converts an hourly wage ($20/hr) into an
annual salary by multiplying by 40 (hours/week) and then by 50
(weeks/year), outputting the final result to the screen.

Google Confidential and Proprietary


zyBooks
Instructions: Sample Processor Instructions

Below are some sample types of instructions that a processor might be able to
execute, where X, Y, Z, and num are each an integer.

Adds data in memory location X to the number num,


Add X, #num, Y
storing result in location Y.
Subtracts num from data in location X, storing result in
Sub X, #num, Y
location Y.
Multiplies data in location X by num, storing result in
Mul X, #num, Y
location Y.
Divides data in location X by num, storing result in
Div X, #num, Y
location Y.
Tells the processor that the next instruction to execute is
Jmp Z
in memory location Z. Google Confidential and Proprietary
zyBooks
Instructions

• For example, the instruction "Mul 97, #9, 98" would


multiply the data in memory location 97 by the number 9,
storing the result into memory location 98.
• So if the data in location 97 were 20, then the instruction
would multiply 20 by 9, storing the result 180 into location
98.
• That instruction would actually be stored in memory as 0s
and 1s, such as "011 1100001 001001 1100010", where 011
specifies a multiply instruction and 1100001, 001001, and
1100010 represent 97, 9, and 98 (as described previously).
Google Confidential and Proprietary
zyBooks
Memory Stores Instructions and Data as 0s and 1s

• The animation below illustrates the storage of instructions and data


in memory for a program that computes F = (9*C)/5 + 32, where C
is memory location 97 and F is memory location 99.

Google Confidential and Proprietary


zyBooks
Instructions (Contd.)

• The programmer-created sequence of instructions is called


a program, application, or just app.
• When powered on, the processor starts by executing the
instruction at location 0, then location 1, then location 2, etc.
• The above program performs the calculation over and over
again. If location 97 is connected to external switches and
location 99 to external lights, then a computer user (like the
women operating the ENIAC computer in the earlier picture)
could set the switches to represent a particular Celsius number,
and the computer would automatically output the Fahrenheit
number using the lights.
Google Confidential and Proprietary
zyBooks
Processor Executing Instructions

Google Confidential and Proprietary


zyBooks
Writing Computer Programs

• In the 1940s, programmers originally wrote each instruction using


0s and 1s, such as "001 1100001 001001 1100010".
• Instructions represented as 0s and 1s are known as machine
instructions, and a sequence of machine instructions together form
an executable program (sometimes just called an executable).
• Because 0s and 1s are hard to comprehend, programmers soon
created programs called assemblers to automatically translate
human readable instructions, such as "Mul 97, #9, 98", known
as assembly language instructions, into machine instructions.
• The assembler program thus helped programmers write more
complex programs.

Google Confidential and Proprietary


zyBooks
Compilers

• In the 1960s and 1970s, programmers created high-level


languages to support programming using formulas or algorithms,
so a programmer could write a formula like: F = (9 /5 ) * C + 32.
• Early high-level languages included FORTRAN (for "Formula
Translator") or ALGOL (for "Algorithmic Language"), which were
more closely related to how humans thought than were machine or
assembly instructions.
• To support high-level languages, programmers created compilers,
which are programs that automatically translate high-level
language programs into executable programs.

Google Confidential and Proprietary


zyBooks
Compilers: Program Compilation and Execution

Google Confidential and Proprietary


zyBooks
The Computer

The term computer has changed meaning over the years. The term
originally referred to a person that performed computations by hand, akin
to an accountant ("We need to hire a computer.") In the 1940s/1950s, the
term began to refer to large machines like in the earlier photo.
• In the 1970s/1980s, the term expanded to also refer to smaller
home/office computers known as personal computers or PCs
("personal" because the computer wasn't shared among multiple users
like the large ones) and to portable/laptop computers.
• In the 2000s/2010s, the term may also cover other computing devices
like pads, book readers, and smart phones.
• The term computer even refers to computing devices embedded inside
other electronic devices such as medical equipment, automobiles,
aircraft, consumer electronics, military systems, etc.
Google Confidential and Proprietary
zyBooks
The Computer: Early Days

• In the early days of computing, the physical equipment was


prone to failures.
• As equipment became more stable and as programs became
larger, the term software became popular to distinguish a
computer's programs from the hardware on which they ran.
• A computer typically consists of several components (see
animation on slide 27)

Google Confidential and Proprietary


zyBooks
Input/Output Devices

• A screen (or monitor) displays items to a user. The above


examples displayed textual items, but today's computers
display graphical items, too.
• A keyboard allows a user to provide input to the computer,
typically accompanied by a mouse for graphical displays.
Keyboards and mice are increasingly being replaced
by touchscreens.
• Other devices provide additional input and output means,
such as microphones, speakers, printers, and USB interfaces.
I/O devices are commonly called peripherals.
Google Confidential and Proprietary
zyBooks
Storage

• A disk (aka hard drive) stores files and other data, such as
program files, song/movie files, or office documents.
• Disks are non-volatile, meaning they maintain their contents even
when powered off.
• They do so by orienting magnetic particles in a 0 or 1 position.
• The disk spins under a head that pulses electricity at just the right
times to orient specific particles (you can sometimes hear the disk
spin and the head clicking as the head moves).
• New flash storage devices store 0s and 1s in a non-volatile
memory, rather than disk by tunnelling electrons into special
circuits on the memory's chip and removing them with a "flash" of
electricity that draws the electrons back out. Google Confidential and Proprietary
zyBooks
Memory

• RAM (random-access memory) temporarily holds data read from storage


and is designed such that any address can be accessed much faster than
disk, in just a few clock ticks (see below) rather than hundreds of ticks.
• The "random access" term comes from being able to access any memory
location quickly and in arbitrary order, without having to spin a disk to
get a proper location under a head.
• RAM is costlier per bit than disk, due to RAM's higher speed.
• RAM chips typically appear on a printed-circuit board along with a
processor chip.
• RAM is volatile, losing its contents when powered off. Memory size is
typically listed in bits or in bytes, where a byte is 8 bits.
• Common sizes involve megabytes (million bytes), gigabytes (billion
bytes), or terabytes (trillion bytes). Google Confidential and Proprietary
zyBooks
Processor

• The processor runs the computer's programs, reading and


executing instructions from memory, performing operations,
and reading/writing data from/to memory.
• When powered on, the processor starts executing the
program whose first instruction is (typically) at memory
location 0.
• That program is commonly called the BIOS (basic
input/output system), which sets up the computer's basic
peripherals.
• The processor then begins executing a program called
an operating system (OS).
Google Confidential and Proprietary
zyBooks
Processor (Contd.)

• The operating system allows a user to run other programs


and interfaces with the many other peripherals.
• Processors are also called CPUs (central processing units)
or microprocessors (a term introduced when processors
began fitting on a single chip, the "micro-" suggesting
something small).
• Because speed is so important, a processor may contain a
small amount of RAM on its own chip,
called cache memory, accessible in one clock tick rather
than several, for maintaining a copy of the most-used
instructions/data.
Google Confidential and Proprietary
zyBooks
Clock

• A processor's instructions execute at a rate governed by the


processor's clock, which ticks at a specific frequency.
• Processors have clocks that tick at rates such as 1 MHz (1 million
ticks/second) for an inexpensive processor ($1) like those found in a
microwave ovens, to 1 GHz (1 billion ticks/second) for costlier
($10-$100) processors like those found in mobile phones/computers.
• Executing about 1 instruction per clock tick, processors thus execute
millions or billions of instructions/second.
• Computers typically run multiple programs simultaneously, such as a
web browser, an office application, a photo editing program, etc.
• The operating system actually runs a little of program A, then a little
of program B, etc., switching between programs thousands of times a
second. Google Confidential and Proprietary
zyBooks
Some Computer Components

Google Confidential and Proprietary


zyBooks
Other Components

After computers were invented and occupied entire rooms,


engineers created smaller switches called transistors, which in
1958 were integrated onto a single chip called an integrated
circuit, or IC.
Engineers continued to make transistors smaller, leading
to Moore's Law: the doubling of IC capacity roughly every 18
months, which continued for several decades.
• Note: Moore actually said every 2 years. And the actual trend
has varied from 18 months. The key is that doubling occurred
roughly every two years, causing much improvement over
time. Intel: Moore's Law.
Google Confidential and Proprietary
zyBooks
Other Components: Microprocessors

• By 1971, Intel produced the first single-IC processor


named the 4004, called
a microprocessor (micro- suggesting something small),
having 2,300 transistors.
• New, more powerful microprocessors appeared every few
years, and by 2012, a single IC had
several billion transistors containing multiple processors
(each called a core).

Google Confidential and Proprietary


zyBooks
Making PCs Faster

A side note: A common way to make a PC faster is to add more RAM.


• A processor spends much of its time moving instructions/data
between memory and storage, because not all of a program's
instructions/data may fit in memory—akin to a chef who spends
most of his/her time walking back and forth between a stove and
pantry.
• Just as adding a larger table next to the stove allows more
ingredients to be kept close by, a larger memory allows more
instructions/data to be kept close to the processor.
• Moore's Law results in RAM being cheaper a few years after
buying a PC, so adding RAM to a several-year-old PC can yield
good speedups for little cost. Google Confidential and Proprietary
zyBooks
Language History

In 1978, Brian Kernighan and Dennis Ritchie at AT&T Bell Labs (which
used computers extensively for automatic phone call routing) published a
book describing a new high-level language with the simple name C,
being named after another language called B (whose name came from a
language called BCPL).
• C became the dominant programming language in the 1980s and
1990s.

In 1985, Bjarne Stroustrup published a book describing a C-based


language called C++, adding constructs to support a style of
programming known as object-oriented programming, along with other
improvements.
• The unusual ++ part of the name comes from ++ being an
operator in C that increases a number, so the name C++ suggests
Google Confidential and Proprietary
zyBooks an increase or improvement over C.
Language History

• Both C and C++ are popular first languages for programming


computers, widely used for desktop and embedded systems.
• Furthermore, C# for Microsoft Windows programming and
Objective-C for iPhone/iPad/Mac programming are C++
variants.
• Many newer languages like Java have a strong C/C++
flavour.
• A June 2019 survey ranking language by their popularity
yielded the following:

Google Confidential and Proprietary


zyBooks
Top Programming Languages Ranked by Popularity

Language Usage by percentage


Java 15%
C 13%
Python 9%
C++ 7%
Visual Basic .NET 5%
C# 4%
JavaScript 3%
PHP 3%
SQL 2% Source: https://www.tiobe.
Assembly language 1% com/tiobe-index/, 2019)

zyBooks
Swift 1% Google Confidential and Proprietary
Programming Languages vs. Problem Solving

• A chef may write a new recipe in English, but creating a new recipe
involves more than just knowing English.
• Similarly, creating a new program involves more than just knowing
a programming language.
• Programming is largely about problem solving: creating a
methodical solution to a given task.

The following are real-life problem-solving situations encountered by


one of this material's authors.

Google Confidential and Proprietary


zyBooks
Solving a (Nonprogramming) Problem: Matching Socks.

A person stated a dislike for matching socks after doing laundry, indicating
there were three kinds of socks. A friend suggested just putting the socks in a
drawer and finding a matching pair each morning. The person said that finding a
matching pair could take forever: Pulling out a first sock and then pulling out a
second, placing them back and repeating until the second sock matches the first
could go on many times (5, 10, or more).

The friend provided a better solution approach: Pull out a first sock, then pull
out a second, and repeat (without placing back) until a pair matches. In the
worst case, if three kinds of socks exist, then the fourth sock will match one of
the first three. Google Confidential and Proprietary
zyBooks
Example: Sorting Name Tags

1,000 name tags were printed and sorted by first name into a stack. A person wishes to
instead sort the tags by last name. Two approaches to solving the problem are:
• Solution approach 1: For each tag, insert that tag into the proper location in a new
last-name-sorted stack.
• Solution approach 2: For each tag, place the tag into one of 26 substacks, one for last
names starting with A, one for B, etc. Then, for each substack's tags (like the A
stack), insert that tag into the proper location of a last-name-sorted stack for that
letter. Finally combine the stacks in order (A's stack on top, then B's stack, etc.).
Solution approach 1 will be very hard; finding the correct insertion location in the new
sorted stack will take time once that stack has about 100 or more items. Solution
approach 2 is faster, because initially dividing into the 26 stacks is easy, and then each
stack is relatively small, so insertions are easier to do.
In fact, sorting is a common problem in programming, and the above sorting approach
is similar to a well-known sorting approach called radix sort.
Google Confidential and Proprietary
zyBooks
Why Programming?

• While careers in law, medicine, and engineering have


existed for hundreds of years, computers are relatively
new so careers in computing are new too.
• Today, computing jobs are often ranked among the best
jobs, in terms of opportunity, salary, work-life balance,
job security, job satisfaction, work conditions, etc.
• Nearly all computing jobs require some training in
programming; some jobs then focus on programming,
while others instead focus on related aspects.

Google Confidential and Proprietary


zyBooks
Computing Careers

• In a 2019 ranking (below), the top job is software developer. In


another ranking, 3 of the top 20 were computing jobs.
• Note: Rankings from different sources vary greatly; some have
more engineers, human resources managers, data scientists,
marketing, etc.
• Also, the specific ordering in a ranking is not usually substantial
(like rank #2 vs. #5), and rankings change every year.
• However, note that most rankings consistently have several
computing jobs in the top tier.

Google Confidential and Proprietary


zyBooks
Best Jobs of 2019, per US News and World Report

• The rankings are based off growth potential, work-life balance, and salary.

Ranking Occupation Description

Designs computer programs,


1 Software developer combining creativity and technical
know-how, often working in teams.

2-4 Statistician, physician's assistant, dentist

5 (tie) Orthodontist, Nurse Anesthetist

7-8 Nurse Practitioner, Pediatrician

Obstetrician and Gynecologist, Oral and


9 (tie) Maxillofacial Surgeon, Prosthodontist, Google Confidential and Proprietary
zyBooks Physician
Computing Jobs: A Wide Variety Exists

2018 Median
Occupation Job Summary Entry-level Education
Pay
Computer and information research scientists
invent and design new approaches to computing
Computer and
technology and find innovative uses for existing Doctoral or professional
Information $111,370
technology. They study and solve complex degree
Research Scientists
problems in computing for business, medicine,
science, and other fields.
Computer network architects design and build
data communication networks, including local
area networks (LANs), wide area networks
Computer Network
(WANs), and intranets. These networks range Bachelor's degree $109,020
Architects
from a small connection between two offices to a
multinational series of globally distributed
communications systems.
Computer programmers write code to create
software programs. They turn the program
Computer
designs created by software developers and Bachelor's degree $84,280
Programmers
engineers into instructions that a computer can Google Confidential and Proprietary
zyBooks follow.
Computing Jobs

Entry-level 2018 Median


Occupation Job Summary
Education Pay
Computer support specialists provide help and advice to
people and organizations using computer software or
Varies:
Computer equipment. Some, called computer network support
High-school
Support specialists, support information technology (IT) $53,470
degree and
Specialists employees within their organization. Others, called
higher
computer user support specialists, assist non-IT users
who are having computer problems.
Computer systems analysts study an organization's
current computer systems and procedures and design
Computer information systems solutions to help the organization Bachelor's
$88,740
Systems Analysts operate more efficiently and effectively. They bring degree
business and information technology (IT) together by
understanding the needs and limitations of both.
Database administrators (DBAs) use specialized
software to store and organize data, such as financial
Database Bachelor's
information and customer shipping records. They make $90,070
Administrators degree Google Confidential and Proprietary
sure that data are available to users and are secure from
zyBooks
unauthorized access.
Computing Jobs (Contd.)

Entry-level 2018 Median


Occupation Job Summary
Education Pay
Information security analysts plan and carry out
Information security measures to protect an organization's
Bachelor's
Security computer networks and systems. Their $98,350
degree
Analysts responsibilities are continually expanding as the
number of cyberattacks increase.

Network and Computer networks are critical parts of almost


Computer every organization. Network and computer Bachelor's
$82,050
Systems systems administrators are responsible for the degree
Administrators day-to-day operation of these networks.

Software developers are the creative minds


behind computer programs. Some develop the
Software applications that allow people to do specific tasks Bachelor's
$105,590
Developers on a computer or other device. Others develop the degree
underlying systems that run the devices or control Google Confidential and Proprietary
zyBooks networks.
Computing Jobs (Contd.)

Entry-level 2018 Median


Occupation Job Summary
Education Pay
Web developers design and create
websites. They are responsible for
the look of the site. They are also
responsible for the site's technical
Associate's
Web Developers aspects, such as performance and $69,430
degree
capacity, which are measures of a
website's speed and how much
traffic the site can handle. They
also may create content for the site.

Source: bls.gov (includes links to detailed descriptions and outlooks for each occupation)
Google Confidential and Proprietary
zyBooks
Programming and Non-computing Jobs

For many non-computing jobs (dentist, attorney, nurse, business, etc.),


computer usage is high, and thus knowledge of computing technology can
yield strong advantages even for people not in a computing career.

Many people in non-computing jobs find that knowing some programming


can benefit their careers. Consider the following hypothetical examples:

Akua majored in chemistry, and now works as a scientist in a


pharmaceutical company. Akua helps analyze clinical trials. Her company
uses commercial statistical software, but she found that writing small
custom programs yielded even better analyses. Her co-workers now come to
her for help. She is glad she took a required programming class in college,
though at the time she wasn't as happy about it.

Google Confidential and Proprietary


Programming and Non-computing Jobs (Contd.)

• Paul majored in civil engineering, and now authors technical


content for a large company.
• Paul noticed that several authoring tasks done in Google
Docs by the in-house 25-person authoring team could be
automated.
• Building on the programming he learned in a required
college course, Paul spent several hours online learning
about Google Docs "add on" programming, and wrote two
small add-ons.
• His add-on programs have become part of the standard
authoring process for the entire team, who frequently thanks
Paul for saving them time and relieving them of tedious
tasks.
Google Confidential and Proprietary
Programming and Non-computing Jobs (Contd)

Gustav majored in business, and got a job in sales operations of a Silicon Valley startup
company. Building on the C++ programming he learned from a college course, he started
tinkering with writing database query programs using "SQL", and discovered he had a
knack for it. His job duties have expanded to include running database reports, and he has
automated dozens of reports via programming, helping people throughout the company be
more productive.

Maame majored in environmental science. She voluntarily took a programming course in


college believing the knowledge/skills could be important to her. She took a job at a
startup company doing various marketing tasks. She began to manage the company's
website, and realized that a few small programs could make the web pages dynamic and
interactive. She wrote the code herself, which was reviewed and approved by the
engineering team and became part of the company's live website. She plans on getting a
graduate degree in environmental science and expects programming will be useful in her
research.

Google Confidential and Proprietary


zyBooks
Precision, Logic and Computational Thinking

• Many people find that programming encourages precise,


logical thought that can lead to better writing and
speaking, clearer processes, and more.

• The thought processes needed to build correct, precise,


logical programs is sometimes called computational
thinking and has benefits beyond programming.

Google Confidential and Proprietary


zyBooks
Computational Thinking

Google Confidential and Proprietary


zyBooks
Computational Thinking

From the examples on the previous slide, it is clear that:

• Common English usage may be vague. Are workers, painters, and


contractors the same people or different? What exactly is white and
brown?
• Programs use one word per item; no synonyms, no pronouns. In
English, using "painters" consistently, and replacing "they" with "The
IDs", yields precise info.
• Policies and other documents often aren't logical, with conflicting or
missing info. How can a person 20 miles away take a taxi if they must
drive? What about 100 miles?
• Programmers use precise structures like "If-else" statements. When
used in English, the result is logical, unambiguous info. Some call this
"computational thinking".
Google Confidential and Proprietary
zyBooks
Computational Thinking

• Programmers use precise structures like "If-else" statements.


When used in English, the result is logical, unambiguous info.
Some call this "computational thinking".

• New programmers often complain about how unforgiving


programming is, but such attention to detail is one of the benefits
of learning programming.

Google Confidential and Proprietary


zyBooks
Computational Thinking

Programming is different than nearly anything most students have


done before. Most new programmers initially struggle. Just as a
child learning to walk will stumble and fall, a student learning to
program will stumble and fall many times as well.

Programs have literally transformed the world in the past few


decades. But, correct programs are hard to create. Programs are
among the most sophisticated of human creations. Even one wrong
symbol in a program with thousands of characters can cause the
program to entirely fail. And programs deal with doing long
sequences of tasks over time. Such features are not common in
other aspects of life.

Google Confidential and Proprietary


zyBooks
Computational Thinking

Programming is a combination of concepts and skill. The skill part is not


as common in other "academic" subjects. Learning to program thus
requires practice.

A student cannot watch a piano teacher play and then walk away playing
piano. Writing correct expressions, properly formed if-else branches,
correctly working loops, etc., requires repeated attempts, and, like the new
piano player, lots of mistakes along the way.

Programming also requires a lot of mental energy. No easy steps exist for
how to solve a given problem by writing a program.

Many students are not accustomed to having to think so hard to solve a


problem, instead looking to follow standard steps or just trying to "look up
the answer".
Google Confidential and Proprietary
zyBooks
Computational Thinking

• Students studying programming are about to embark on


one of the most rewarding but also the most challenging of
human endeavours.
• When stuck, students may wish to take solace that
everyone struggles.
• Like the child learning to walk, each fall hurts, but know
that each fall brings one closer to learning a powerful skill.

Even the best programmers make mistakes. In San Diego


2012, a software bug caused 17-minutes of fireworks to
launch nearly simultaneously.
Google Confidential and Proprietary
zyBooks
When Software Goes Wrong

Google Confidential and Proprietary


References

• Felleisen, M., Findler, R. B., Flatt, M., & Krishnamurthi, S. (2011).


How to Design Programs: An Introduction to Programming and
Computing, Cambridge, MA: MIT Press
• Frank Vahid, and Roman Lysecky (2019). Programming in C++, August
2019. zyBook ISBN: 978-1-5418-9966-7

Google Confidential and Proprietary

You might also like