0% found this document useful (0 votes)
3 views

Coding For Parents Frazer Wilson download

The document is a promotional overview of 'Coding for Parents' by Frazer Wilson, which aims to help parents understand coding concepts to assist their children with programming homework. It covers various coding languages and tools, including Scratch, HTML, CSS, and JavaScript, providing a structured approach to learning. The book emphasizes the importance of coding in today's digital world and encourages parents to engage with their children's education in technology.

Uploaded by

huibowelale
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)
3 views

Coding For Parents Frazer Wilson download

The document is a promotional overview of 'Coding for Parents' by Frazer Wilson, which aims to help parents understand coding concepts to assist their children with programming homework. It covers various coding languages and tools, including Scratch, HTML, CSS, and JavaScript, providing a structured approach to learning. The book emphasizes the importance of coding in today's digital world and encourages parents to engage with their children's education in technology.

Uploaded by

huibowelale
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/ 84

Coding For Parents Frazer Wilson download

https://ebookbell.com/product/coding-for-parents-frazer-
wilson-30097868

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Courage After Fire For Parents Of Service Members Strategies For


Coping When Your Son Or Daughter Returns From Deployment Paula
Domenici

https://ebookbell.com/product/courage-after-fire-for-parents-of-
service-members-strategies-for-coping-when-your-son-or-daughter-
returns-from-deployment-paula-domenici-46312988

Getting Through My Parents Divorce A Workbook For Children Coping With


Divorce Parental Alienation And Loyalty Conflicts Andre

https://ebookbell.com/product/getting-through-my-parents-divorce-a-
workbook-for-children-coping-with-divorce-parental-alienation-and-
loyalty-conflicts-andre-11336362

A Parents Guide To Managing Childhood Grief 100 Activities For Coping


Comforting Overcoming Sadness Fear Loss Katie Lear

https://ebookbell.com/product/a-parents-guide-to-managing-childhood-
grief-100-activities-for-coping-comforting-overcoming-sadness-fear-
loss-katie-lear-46417396

A Parents Guide To Managing Childhood Grief 100 Activities For Coping


Comforting Overcoming Sadness Fear Loss Katie Lear

https://ebookbell.com/product/a-parents-guide-to-managing-childhood-
grief-100-activities-for-coping-comforting-overcoming-sadness-fear-
loss-katie-lear-43764488
Dr Paulas Good Nutrition Guide For Babies Toddlers And Preschoolers
Answers To Parents Most Common Questions Plus Help For Coping With
Fussy Eaters Paula Elbirt

https://ebookbell.com/product/dr-paulas-good-nutrition-guide-for-
babies-toddlers-and-preschoolers-answers-to-parents-most-common-
questions-plus-help-for-coping-with-fussy-eaters-paula-elbirt-1382204

Coping With Parental Death Insights And Tips For Teenagers Michelle
Shreeve

https://ebookbell.com/product/coping-with-parental-death-insights-and-
tips-for-teenagers-michelle-shreeve-46360036

Coding For Beginners In Easy Steps Basic Programming For All Ages Mike
Mcgrath

https://ebookbell.com/product/coding-for-beginners-in-easy-steps-
basic-programming-for-all-ages-mike-mcgrath-46474102

Coding For Beginners 13th Papercut Limited

https://ebookbell.com/product/coding-for-beginners-13th-papercut-
limited-47505760

Coding For Pediatrics 2022 A Manual For Pediatric Documentation And


Payment Twentyseventh American Academy Of Pediatrics Committee On
Coding And Nomenclature

https://ebookbell.com/product/coding-for-pediatrics-2022-a-manual-for-
pediatric-documentation-and-payment-twentyseventh-american-academy-of-
pediatrics-committee-on-coding-and-nomenclature-48844096
STERLING
N ew Y o rk
An Imprint of Sterling Publishing Co., Inc.
1166 Avenue of the Americas
New York, NY 10036

STERLING and the distinctive Sterling logo are


registered trademarks of Sterling Publishing Co., Inc.

Text © 2017 by Weldon Owen Ltd.


Images © 2017 by Shutterstock.com

All rights reserved. No part of this publication may be reproduced,


stored in a retrieval system, or transmitted in any form or by any
means (including electronic, mechanical, photocopying,
recording, or otherwise) without prior written
permission from the publisher.

ISBN: 978-1-4549-2567-5

Distributed in Canada by Sterling Publishing Co., Inc.


c/o Canadian Manda Group, 664 Annette Street
Toronto, Ontario, Canada M6S 2C8
For information about custom editions, special sales, and
premium and corporate purchases, please contact
Sterling Special Sales at 800-805-5489
or [email protected]
Manufactured in China
2 4 6 8 10 9 7 5 3 1

www.sterlingpublishing.com
CODING
FOR PARENTS
FRAZER W IL S O N

JuV-
v v #
S T E R L IN G
N e w Yo r k
FOREWORD

Approaching coding as a learner and also as a guide for kids can


be intimidating, but this book will make it easier!
As moms and dads, we know education. We went to school, we attended
classes, we rule this turf—and for a long time, we’ve known it well enough
to transfer this expertise to our children when they've needed help. For
decades, our adorable offspring have sat down at the end of the school
day, opened their textbooks, and tackled homework with which we could
easily assist: multiplication tables, spelling words, map coloring.
But now, the educational landscape has changed. Kids don’t stuff books
into their backpacks, they access PDFs via their iPads and laptops. They
don’t call a friend to discuss an assignment, they 00 V00 chums to figure
it out (and socialize a bit, too). They don't type and hand in a paper, they
word process it, clear it for originality through Turnitin, and then submit it
online to their teacher. Multiplication and spelling quizzes? There are apps
for those. And maps? Google affords learners the most up-to-date, real
satellite and street maps of the entire planet—no more paper copies of
mystery squiggle countries in outline. No matter what subject matter your
kids are learning, there's probably a playlist of YouTube videos providing
instructional help on that topic. With new technology topics you never
studied in school—like coding—it’s a relief to know that all those resources
are available.
So where does that leave you—what is your role as an interested and
engaged parent? How are you supposed to stay "in the loop” and offer
support to your children when they need actual human help? It may be of
worth to first acknowledge how you may be feeling about the monumental
shift between how you were taught and what you know—and how your
kids are being taught and what they are expected to know. If you're feeling
that the change is a little scary, don't worry, you're not alone. But as Sheryl
Sandberg, COO of Facebook, famously asks, "What would you do if you

4 // F O R E W O R D
weren't afraid?" You would find the resources and guidance that you need
in order to provide your children the help that they need. And that’s where
Coding for Parents comes in handy!

Recognizing that you are playing two roles—a learner who may be new
to coding, and a guide who is seeking to assist your children—this book
presents you with clear examples, easy-to-understand images, and just the
right quantity of text to clarify each concept. You’ll find helpful guidance
that introduces you to coding in the same manner your children are
being introduced to it: building gently and progressively, from simple tile
languages like Scratch to web basics (including HTML and CSS), and finally
to web interactivity (JavaScript).
As with many activities in which we coach our children, we learn and
improve as we go. You are not expected to be an instant expert in coding,
and Coding for Parents understands and values your concerns. There
will be occasions when you'll need to work through a section, put the
book down and reflect on the ideas, then return to the material later.
That's OK! It won't happen too often, but know that this is normal when
working to develop a completely new skill set. I encounter this situation
often, and when I do, I share my concerns with my own children. The soft
skills of remaining optimistic, pushing through challenges, and consulting
resources (people, books, and other tools) are equally important messages
to your kids as elevating coding skills. Ultimately, you and your kids will
benefit from Coding for Parents, setting the stage for success in future
technological forays we have yet to dream up!

Camille McCue, PhD


Author • Educator • Innovator
camillemccue.com

F O R E W O R D // 5
CONTENTS

IN T R O D U C T IO N / / 8
The introductory section explains what coding is, as well as common uses,
common misconceptions, what you will need to get started, and a simple
guide to this book.

CHAPTER 1: C O D IN G CONCEPTS / / 18
Key concepts of coding are based on logic and common sense. This
chapter will teach you how to think in a new way—and you won't even need
a computer!

CHAPTER 2: W H A T IS SCRATCH? / / 56
Scratch is a great program for beginner coders. Learn to use it to write
simple code blocks in a visual format and create dynamic animations.
Includes several sample projects.

CHAPTER 3: W H A T ARE HTML AN D CSS? / / 86


Here’s where the serious coding begins! HTML code creates the structure of
websites, and CSS adds decorative elements to make them look amazing.
Learn to build a basic website over the course of this chapter, one element
at a time.

6 // C O N T E N T S
#
CHAPTER 4: W H A T IS JAVASCRIPT? / / 136
JavaScript is a programming language used to make web pages interactive.
Learn the key elements of JavaScript, and work on sample projects for
coding interactive web pages.

FURTHER LE A R N IN G / / 188
A closing section discusses areas of further study, from programming
languages not covered in this book to advanced coding skills. Resources
for online learning are explained, and finally some tips to encourage your
coding practice—a great note to end on!

GLOSSARY / / 196

IN D E X / / 2 0 6

ACKNOWLEDGMENTS / / 208

C O N T E N T S // 7
INTR O D UCTIO N

Learning the fundamentals of coding will allow you to help kids


with their homework, while teaching you a new way to think.
This guide to coding has been written especially for parents, just like you,
whose children are learning computer programming in school. Curriculum
can vary, but coding is becoming increasingly important in classrooms and
at home in the form of homework. If you are used to helping your children,
but have no background in writing software this can seem very daunting.
There is a world of terminology to grasp, and if you are out of the habit of
learning, this can prove a challenge.
Rest assured, understanding the concepts behind coding—and its
importance in today’s world—is within your reach. This guide introduces
exactly what coding is and what you need to get started. You will learn
how to use Scratch (a great program for beginners) as well as more
in-depth HTML and CSS, the building blocks for websites. Also included
is an explanation of JavaScript, the programming language that allows
interactive elements to be added, which will take your website knowledge
even further.

SYMBOL KEY

f -c ? v'
Tips and Activities and Key points Concepts
inspiration mini-tasks and tricks to
remember

8 // I N T R O D U C T I O N
One of the best ways to learn is by doing, so this guide encourages
practical application of the topics covered. Throughout the book, notes,
tips, and activities are included to help you add another level to your
learning. Enjoy the process of developing a new skill and keep on track by
referring to the glossary (terms are bolded throughout). Once you have
mastered the basics, there is advice for further learning in the last chapter
of the book. Children learn incredibly quickly and are used to the fast-
paced nature of technology, but there is no need to be left behind—work
together with your kids to develop a skill that is certain to be of use to you
both in the future!
In this book, we will introduce some examples of key coding concepts to
highlight the way in which a machine organizes and processes information.
We will look at how mistakes can occur, how to create organized, beautiful
code examples, and even build some cool animations, games, and
applications using a range of coding programs. This book will provide
you with a helpful introduction to coding, setting you up with a solid
understanding of its key concepts and a clear starting point for further
learning. In an increasingly digitized world, a grasp of coding can offer
many exciting opportunities.
Children are being taught the basics of programming in schools to prepare
them for today’s digital culture, and it's important for the rest of us to do
our best to keep up! As well as being especially helpful for imparting a base
level of knowledge to inspire continued study, this book will prepare you to
help young beginner coders with their homework!

Notes on an Parent notes References Diagrams and


on goin g project analysis

I N T R O D U C T I O N // 9
WHAT IS C O D I N G ?
Y
,_________________________ J
Coding is a language, and also a logic-based way of thinking.
At its simplest, learning to code is simply learning to tell machines what to
do. Code is the language used to give instructions to a computer for every
task it performs from displaying words on a screen, to running elaborate
animations. Send a text, take money from an ATM, play a video game, and
you are relying on people having written the code that makes it possible.
Unlike the languages used by people to communicate with each other,
which can be vague, emotional, or even irrational, coding languages are
fixed, logical, and precise. They have to be, because computers take
everything literally!
Imagine this scenario: you're about to ask a friend to buy you some
snacks. You need to provide money, directions to the store, and a list of
your favorite foods. It sounds simple, but your friend would still need to
make decisions in order to succeed, considering the information you have
provided. They would need to follow directions, (deciding what to do if
they got lost on the way): at the store, they would have to consider each
item to see if it met your criteria. They would also have to check each
snack's cost against the current total of the purchase and the total amount
of money they have; then they would have to complete the purchase,
collect any change, and return to you.

The process would be simple enough for your friend, as these decisions can
be made intuitively, but a machine has no intuition to fall back on. A coder
would need to find a specific way to instruct a machine. There are values to
remember (directions, money total), repeatable actions (considering snack
options), and comparisons (checking price against total), making this a
very tricky task indeed for a machine.

This book will introduce you to computational thinking, and give you the
tools to program code for just this sort of task.

10 // I N T R O D U C T I O N
H O W DID W E GET HERE?
Here are some of the key milestones in the creation and development of
modern coded machines.

First “thinking” machine: Calculating devices have


been around since the abacus, but the first mechanical
computer to complete complex sums was the difference
engine completed by Charles Babbage in the early
nineteenth century. Together with Ada Lovelace, he
devised plans for a more advanced analytical engine, but
it was never completed. Their work was the beginning of
multipurpose thinking machines.
First computers: In the age of electricity, faster and
more advanced machines could now be built. Some early
examples are the Atanasoff-Berry computer (ABC) and
ENIAC (Electronic Numerical Integrator And Computer)
in the mid-twentieth century. Early computers were used
to predict missile trajectory and crack coded messages
during WWII.
Personal computers: Personal computers (or
PCs) became available in the 1960s, but had to be
programmed by hand. Later innovations from companies
like Microsoft and Apple built in operating systems so
it became simpler for users to complete tasks without
needing to program each command manually.
The Internet: Eventually machines were able to connect
and share information in networks, which led to the
Internet emerging in the early 1990s.
Modern innovations: Computers began as large and
inefficient machines, but can now load music, videos,
and games remotely on small portable phones. The
future could see intelligent machines integrated into
everyday items—or even human beings—to make our
lives easier.

■r-
I N T R O D U C T I O N // 11
U S E S OF C O D I N G

Computer code is an integral part of the modern world, and


learning to understand it will give you many advantages.
Computer code underlies the function of so many of the machines we
take for granted. It takes many forms and performs many functions from
running hardware like computers, ATMs, and airplanes to software like
apps and operating systems. People who work with code are usually called
coders, programmers, or developers, but as the technology of the world
evolves, so do the uses of coding skills. People in all industries can benefit
from learning these skills, and so can schoolchildren.

KIDS W H O CODE
Like everything, coding is actually easier to learn for children than for
adults—the key is to understand computational thinking, and to grasp what
is possible within its frameworks. It really is like learning a new language!
All that's required to learn coding is a grasp of logic. The program Scratch,
covered in Chapter 2, was originally designed for kids eight and up, but
can be used by younger children (basic reading is required, and adult
supervision or parental controls are recommended for young children
using the Internet). The later chapters of this book focus on HTML, CSS,
and JavaScript, which are very detail-oriented and can be frustrating for
younger children (and adult beginners!), but certainly not impossible.
Coding is a fantastic skill, well worth learning at any age!

12 // I N T R O D U C T I O N
GET KIDS EXCITED A B O U T CAREER O P TIO N S
Skills in coding are increasingly valuable as advances in technology and
computing produce greater demand. If kids find coding an exciting and
challenging hobby then it could be worth encouraging them to think about
careers that involve coding tasks—and there are all kindsf

Web developm ent

There are many creative careers relating to building and maintaining


websites and applications, from designing the interface and user
experience to implementing web pages using logic and testing.

Gam ing

The gaming industry is huge and varied with many careers for people to
write, build, and test new projects. Modern games are usually complex with
detailed graphics, but just like the simple projects we will learn to build in
this book, they need to follow logical steps and avoid errors.

Software

Browsers are used to run our web code, but the browsers themselves
are built with code! Beyond the web, computer software and operating
systems are always in need of coders to keep them updated.

AI

Al (artificial intelligence) is the programming of machines to absorb,


process, and make decisions based on input. This can take many forms, like
autonomous, driverless cars and voice-automated assistant programs.

Data science

Using large amounts of input data, statistical analysis can provide insight
into trends and behaviors. Using supercomputers, which are large-capacity
and fast processing machines, many records can be processed so that data
scientists can predict otherwise unpredictable outcomes, for example the
financial market.

n I N T R O D U C T I O N // 13
M ISCO N CEPTIO N S
ABOUT CO D IN G
______________ ___ ___________________________________________ j
Y
Here are some common myths that m ight put you off
encouraging your kids to code—let’s dispel them!

£ Myth: You need to be really good at math

Truth: A page of complicated code might look similar to a page of sums


and equations, leading many to think the two are similar. Coding can
require you to think in a logical, structured way and can involve numbers,
but you don't necessarily need to be good at math to learn to code. There
are crossovers with math such as the focus on problem-solving and the use
of representative numbers, but there are no mathematical prerequisites to
learning code.

4 > Myth: C oding is boring and not creative

Truth: Compared to arts subjects, it is easy to see why coding can


seem dull and uninspiring. An initial glance at a page of code seems dry
compared to photos, paintings, or sculpture, but coding can be incredibly
imaginative. Not only can coding be used to create beautiful games and
applications, but functional, interactive content completely hand-tailored
by their creator. The process of coding can be an addictively entertaining
hobby that involves solving problems with a creative mindset. It just takes a
little understanding.

14 // I N T R O D U C T I O N
0 Myth: You need expensive com puters and software

Truth: Nope. Fast, modern computers are necessary for some art and video
software and that need high processing power and memory, but code itself
is just text. A PC or laptop with a text editor program and a browser is
sufficient to get started—you don't even need an Internet connection!

0 Myth: It’s really com plicated


Truth: Like most subjects, coding does become more complicated as you
progress and learn more, but this shouldn't be a block to getting started.
A glance at a page of complex code may appear daunting to a beginner,
but don't worry, we will start small. This book begins at the ground level to
introduce concepts, then gradually builds toward simple code blocks and
eventually some more involved code, giving every new addition a context
and explanation. By the time you get to the end, that page of code might
not seem so complicated after all!

Myth: It's a very lonely activity

Truth: Often when people think of a computer programmer, they imagine


a geeky person coding alone in their room—but this just isn’t true! A great
deal of learning involves seeking help, either by searching online or testing
your projects with friends and family. Coding with friends is an effective
strategy and joining (or setting up) study groups is common practice to
keep you motivated and improving. Coding is about building things to be
used by others, so it is important to introduce a social element to your
work, even if it’s just sharing to get feedback.

I N T R O D U C T I O N // 15
G E T T I N G STARTED
____________________________________________ J
y"

As with any new skill, it’s im portant to start at the beginning and
build your knowledge.

There are many ways that you could approach learning to code. A large
percentage of professional developers are entirely or partly self-taught,
as the field is so new and these skills have only recently been deemed
teachable. Learning through necessity is effective, but it will give you
the skills to perform only specific tasks and could leave gaps in your
understanding, so we will begin with the basics.
By beginning with the concepts that coding is built upon, you
can focus on what the code does, rather than worrying about the
format. Once we have covered the logic, we will look at Scratch
software, which is designed to easily introduce computational
thinking. From there we will begin to look at hand-typed code
with HTML and CSS web pages, then finally, we will explore the
use of JavaScript to alter the inputs and behavior of web pages.
With this progression from thought to tools and software, you
will hopefully appreciate the fundamentals and gain a solid
SETTING UP
Our opening chapter does not require any software, though you may want
to take notes or draw out your own algorithms on paper. For the later
chapters you will need a computer to complete the exercises. You will need
an Internet connection to access Scratch for Chapter 2, as well as an email
address to sign up, but the software is free. You will also need a simple
HTML text editor program to complete Chapters 3 and 4. These are also
free to download, and we have suggested several options.

TABLET OR COMPUTER?
You could use a tablet to follow along with this book, but you may find it
more difficult in the later coding chapters, which require heavy amounts
of typing and symbols (such as </"|>) that could be difficult on a tablet.
The process of saving and refreshing web pages requires frequent jumping
between applications, which can also be harder on a tablet. A laptop or PC
will be the best tool for coding.

G O O D C O D IN G BEHAVIORS
As we will discover in this book, there are some behaviors, general policies,
and attributes of writing effective code. Some of these will involve the
formatting and simplification of the code itself, but also attention to detail
and commitment to making things work correctly. Try to avoid directly
copying examples from the book without first examining what is happening
and why. This will keep you thinking creatively and actively learning, which
are both key to becoming a great coder!

I N T R O D U C T I O N // 17
CO DING CO NCEPTS

Get to grips with coding—without the code!


In this chapter we are not going to use any specific code—we don't even
need a computer, only basic logic. To begin with, we will look at some
of the ideas and concepts commonly used in coding and explain why a
computer "thinks" or functions in a certain way. These key concepts will
explain the necessity and the primary function of code—understanding the
why of code makes it a lot easier to learn the how!

IN THIS CHAPTER W E W IL L COVER:


• Algorithms
• Conditional flow
• Variables and their four main types
• Ways to be effective and efficient
• Testing and solving problems

COMPUTER-FREE CODING

You will not need a computer or any software for this chapter, as we are
looking at ideas rather than direct code. You may need a pencil and paper to
follow mini-challenges and try drawing your own functions.

18 // C O D I N G C O N C E P T S
P R OG R A M M I N G LANGUAGES
There are many different programming languages (such as HTML,
JavaScript, etc.). Once you've learned one, it will be easier to pick up a
second programming language, as they are based on similar concepts.
Learning the core basics independently of a particular language or
software should make it easier to take on any programming language you
choose. It may also be helpful to refer back to this chapter when we begin
coding in later chapters.

^ Building blocks
The core concepts, or building blocks of coding (such as loops, functions,
conditions, and variables) are used similarly by different programming
languages and software.

C O D I N G C O N C E P T S // 19
UNDERSTANDING
ALGORITHM S

The algorithm is essentially a set of directions for com pleting a


task. It is the necessary foundation of all code functions.
Algorithm is a term often used with regards to computers, but it’s really
just a list of ordered instructions. You could create an algorithm to explain
how to complete any task—making a cup of coffee, finding a location, or
even a dance routine. An algorithm is useful when the order that tasks are
completed in is important and a description might be too confusing. As
computers are logical and need strict instructions, code is generally written
in algorithms so that the computer can understand what it is supposed to
do and work as expected.

{)( Algorithm : Getting Ready in the Morning

20 // C O D I N G C O N C E P T S
RULES OF THE ALG ORI THM
Define start and end points

Make sure there is a clearly defined start and end point, so


the program cannot start from anywhere but the first step,
and it’s clear when the instructions have been completed.

One at a time

Each step must be completed before you can start the next.
Algorithms don’t allow for multitasking, although you can
write a single step that includes multiple actions.

Values needed

Most instructions are either done or not done, but some


might require additional inputs. For example, a functional
algorithm would have to define "eating breakfast’’ for a
computer.

Conditional flow

Steps must proceed in order as conditions are met—you


must get dressed before you can leave the house, for
example!

W HO IS IT FOR? M IN I TASK

In coding, algorithms are written Parents, try to write your own


for computers, but in this chapter algorithm for a daily routine.
you are following the algorithm, so Use the main diagram as a
the text may refer to "you,’’ rather guide and make sure everything
than ’’the program." works in the correct order (it
should probably start with "wake
up” and end with "go to sleep.")

C O D I N G C O N C E P T S // 21
MORE ALG O RITH M S
,________________________ J
V
To create more complex algorithms capable of performing
complicated tasks, we will need to add options for customization.
Another reason the algorithm is ideal for telling computers what to do,
is that it can offer options, allowing the computer to make decisions and
calculate information. This means that the same algorithm can work in lots
of situations with different inputs (information provided by users) and
solve different problems. Clever algorithms that can do repeatable tasks,
but not always the exact same way, are a vital reason why computers are
so efficient and powerful.

Q Algorithm: Making Coffee

22 // C O D I N G C O N C E P T S
MORE RULES OF A L GO R I TH MS
The "Making Coffee" algorithm uses some
additional rules to vary the final output.

Loops

A waiting step is called a loop and in this


example, ensures the coffee is not poured until
it's ready.

Flow

In this diagram, arrows, representing flow, take


the program to the next step. There is always
a next step so the algorithm continues to flow
until it gets to the end.

Keep the order

The sequence of events is important. Just look


at the getting-ready algorithm—you wouldn't
put your clothes on before getting in the
shower, would you?

Conditionals

Some steps are called conditionals. They are


points of diversion, where the user must make
a choice that affects the eventual outcome.

End

As before, it is important that despite the end


options chosen, the algorithm always reaches
completion at the end step.

C O D I N G C O N C E P T S // 23
CO ND ITIONS

Conditions are the tools necessary for a com puter to make


decisions and run algorithms and programs.
In the last section, our coffee-making algorithm posed a choice with
optional steps for adding milk and sugar, and instructions for proceeding
based on "yes” or “no" answers. This is called conditional flow (where flow
refers to the steps of the algorithm being completed in their designated
order). Sometimes in coding, the program may need to make decisions,
and if that's the case, it needs to know clearly how to do this. Conditions
will tell your program how to make a decision, and how to proceed in every
possible eventuality.

IF/ELS E
An if/else statement is a type of conditional that instructs a program what
to do if it passes a requirement, or alternatively what to do if it fails. In the
diagram on the opposite page, we use a series of questions and if/else
branching to guess what type of pet you might have. At every decision­
making point, there is an option given if the statement is accepted, and
another option in case it is not.

A N D /O R
If you are checking for multiple things, you may check a combination using
and/or values. Using "and" will do something if both conditions are met.
Using "or” will do something if one of the conditions is met. Using these
together will allow for a more powerful ability to query information.

24 // C O D I N G C O N C E P T S
What pet do you have?
0
Follow the questions and the flow diagram will guess your answer!

GO W IT H THE FLOW M IN I TASK

Remember: there should always be a Using the flow chart, work out
plan for what to do in every scenario. which animals will be found for
If the algorithm doesn't know what to the following queries:
do (for example, if the person guessing • Has 2 legs, can fly OR
doesn't actually have a pet) there is no cannot fly
route to proceed, it cannot finish and • Has 4 legs AND eats meat
the flow will be broken. • Does not have 4 legs AND
can fly OR has gills

C O D I N G C O N C E P T S // 25
LOOPS

Looping is an essential tool for repeating tasks and finding


information by repeating the same code a set number of times.
One of the benefits of algorithms is that they can be repeated over and
over automatically as part of the flow, rather than having to stop and
repeat the same instructions manually each time. Sometimes, we may want
to set a task to repeat a certain number of times, and for this we use loops.
Loops involve specifying a task that can then be repeated. Once we have
defined the task, we can refer back to it quickly, making our algorithms
even more efficient.

Looped algorithm: Mail Delivery


O
An algorithm for a mailman gives a task list (called a function) for delivering
mail, then uses loops, so the delivery task list is repeated at each house. This
saves us from having to give the same set of instructions for each house
along the route. See the task list on the left, and the outcome on the right.

26 // C O D I N G C O N C E P T S
USING LOOPS FOR O UTPUT
Using dynamic values (which can be edited) we can write an algorithm
to reduce a list of instructions to one instruction that contains loops. For
example, to instruct a program to complete a repetitive numerical task, you
could create an algorithm that loops for every number in a set range.

^J[ Looped algorithm : Writing Your Times Tables

r -------
fo r 1-5

w ri te number x 7

S__________

USING LOOPS TO SEARCH


To search for information, we can write an algorithm to check through
items in a list until it finds the value it is looking for. For efficiency, we would
set a loop to check every item on the list, but to stop once the correct
answer is found, even if there are still items which have not been checked.

Q Looped algorithm : Find Cleo

C O D I N G C O N C E P T S // 27
FUNCTIONS

It’s tim e to upgrade our algorithms into functions by adding


some code-specific elements.
A function is a coding term meaning a repeatable task, which can calculate
information and output results based on different inputs. This may sound
very similar to an algorithm, and that’s because a function is a type of
algorithm, but while algorithms aren't specifically related to computing,
functions are. They use specific tools such as variables that we will use in
our coding, so we will be working with functions from now on.
Functions are essentially saved blocks of information that can be called
upon when needed. They also take in specific values called parameters
(usually given as a choice between options), which can be used in the
function's calculations and decision-making. On the opposite page,
our coffee-making algorithm (see page 22) has been adapted into a
programming function. We have added more options, so users can now
specify a type of drink, what, if anything, to add to it, and whether they
take sugar. See the function diagram opposite, and annotations below.

^Jt "Make a Drink" function elements

© By giving the function an identifiable name "Make a Drink," we will


recognize it easily and can reuse it as needed.
© Our check "is it ready" will now loop until the water is ready. If the
check comes back negative (i.e., the water is not hot enough) the
function will wait one minute, then start over. The second "make
drink" line shows the function being called again within the function,
starting itself over.
(5) The green boxes represent parameters, which are set by the user. So in
this function you could specify a different type of drink: tea, or cocoa,
for example. Here you specify what the variable "drink” means in
the function.

28 // C O D I N G C O N C E P T S
^ Function: Make a Drink

r-
KEY

fu n c tio n s

"--------------------------------
v a ria b le s p a ra m e te rs ""] end
□ j

. “
make a d r i n k typ e o p tio n sugar
©
b o il w a te r ©
wai t 1 mi nute
if “ is i t h o t enough” eq u als f a ls e

make a d r i n k typ e o p tio n sugar

e ls e pour in t o cup

d r in k equals typ e ©

add ite m o p tio n

©
add ite m sugar

s t i r d r in k

r e tu r n d r i nk ©

© We can also make functions to run inside of functions (nested


functions), so any similar code can be minified for simplicity. Here we
have separated the adding of items like milk and sugar into separate
functions, which can be called as needed to give us more control.
(5) We end the function with a return, which is the end result of our
function—our answer. In this case the return is our completed drink.

C O D I N G C O N C E P T S // 29
V A R IA B L E S

Variables are stored values that can be inserted into functions.


You can think of a variable as a container for information.
So far we have made our functions work by analyzing the information
directly entered into them as parameters (such as milk and sugars),
but sometimes we may need to make our own values to analyze. Using
variables we can create values that a function remembers and can change
based on what happens. A variable could be used in a game, for example
to check the user’s score or keep track of levels. A variable can also be a
useful way to create a setting, meaning you would only need to change one
value rather than many.

Value variables
The variable "dogs" is a saved list of dogs that is updated when we apply
functions to it, as below. The function "add dog (name)" will add another
dog to the information stored in the original variable "dogs."

e q u a ls : s p ik e , b u s te r

e q u a ls : 2

x n
e q u a ls : 3
;-'Y
i i
number o f dogs e q u a ls : 4

30 // C O D I N G C O N C E P T S
VARIABLE TYPES
Variables can be inputs (values added by users) or even combinations of
other variables. Many types of function can be carried out on variables
based on their type. The next pages will look at four types of variable.

Input variables
"First" and "second" are input variables, and "full name" is a combination of
two variables. Editing either of the input variables will update "full name."

e q u a ls “ lo h n ”

e q u a ls " S m it h ”

e q u a ls first p lu s second

Reusing a variable
Another benefit of variables is the fact that they can be reused. By making
a variable for a character's name in a story, for example, we can edit the
variable to change the name throughout the story, rather than manually
changing each instance. This is an example of a config value.

called name yiscalled Benin.


Name is four iyars old. WLea e q u a ls B e n ji B e n i 1 is lour uears old.
it s tLe wtetteed. I take name YILetr it s tLe weekend, I take
to tLe park. Name, loves to B e n ii to tLe fork. B e n i i .
rufv abd cLa.se ahd fetcL. loves to ruK ayU cLa.se aed p/ayy
Name is a <^od aVy. fetcL. B e n i 1 is a a^od doo^

C O D I N G C O N C E P T S / / 31
INTEGERS AND
BOOLEANS

Two common variable types are integers (numbers) and


Booleans (true/false values).
In the last section we introduced the concept of variables and what
they can be used for. Different variable types can provide functions with
different capabilities, so it's worth discussing them in more depth. Integers
and Booleans are two key types of variables used in coding.

INTEGERS
Simply put, integers are variables for whole numbers. Setting a variable
integer is obviously helpful for tracking a number in your code (such as the
quantity of something or how many times an action should be performed)
and integers allow you to make mathematical changes through functions
(such as addition/subtraction).
Numbers can also be used for checking if something has reached a
maximum or minimum value, or if it is equal to a certain numerical
requirement. Setting integer variables is also a key component of algebra,
where the character x is most commonly used to represent the variable.

Variables in algebra
The equations below show how variables are used in simple algebra, but
they can be used for much more complex math, and more.

32 // C O D I N G C O N C E P T S
BO O LEANS
Booleans are the simplest variable type as there are only two possible
values: true or false. A Boolean value will always be either true or false,
making it ideal for something you need to set as on or off, done or not
done. While this may seem limiting compared to numbers or text, it’s
sometimes very helpful to make a simple switch variable with a clear status
(such as adding milk or not in our coffee-making algorithm on page 22).
Functions can use Boolean variables to identify all the true statements
from a list, or to return a list of tasks that still need to be done. They
are a useful tool for sorting data. In the diagram on page 32, you could use
a function to query whether ”x” is greater than 4, or divisible by 5, and the
return would be either true or false; a Boolean value.

0 Using Boolean values to sort data

B o o le a n v a lu e

tru e

tru e

f a l se

f a l se

C o m p le te d ta s k s e q u a ls : 2

C O D I N G C O N C E P T S // 33
S T R I N G S A N D L IS T S
J
V
Variables can be text, or even combinations of other variables,
allowing you to set up even more complex types of function.

STRINGS
Strings are variables made up of text values. You may use a text variable
for a name or label, and you could perform functions on a string to check
its length (how many text characters it has), change the text (such as
convert to all capitals), or combine with other strings. If you refer back to
our "Make a Drink" function (page 29), the variable “drink" has to be set
to a parameter, "type," which could be a value like coffee, tea, cocoa, etc.
These are all examples of string variables.

LISTS
The final variable type we will look at is lists (sometimes called arrays).
Lists can be combinations of string, integer, and Boolean values, and
are helpful for storing a sequence of information. Functions can use list
variables to check their length and add and remove things from them, as
well as checking for specific items using a loop, or requesting an index
from the list. This is all very helpful for organizing and presenting data.

PRACTICE MAKES PERFECT

Parents, this is a good topic to practice until kids can identify variable types
automatically. Try identifying examples of each type in a newspaper page,
highlighting each in a different color. Once you start noticing them, you'll see
variable types everywhere!

34 // C O D I N G C O N C E P T S
yt Identifying variable types
Different variable types allow functions to use their information to check
different things. Take a look at the variables below, which include all the
types we have discussed. With all these variables, you could build a detailed
function. You can check if the name is too long because it is a string, you
can check the age is not too old as it is an integer. You can check if the
person owns a pet because it is a Boolean, and you can check how many
pets because the value is a list. You could also query the list variable to find
out how many pets there are, and check there aren't too many, or find a
specific entry (for example, the third pet is "Spots").

v a ria b le va lu e v a ria b le type

name Susan s t r in g

age 43 — in te g e r

has a p e t tr u e Boolean

p e ts

C O D I N G C O N C E P T S // 35
USER INPUTS

Input values are provided by the user, which present their own
unique challenges.
The user is whoever your code is built for, and user input means any
information or interaction that the user provides. For example, in a game
the user might press a button or select an option, or on a website the user
might fill in a form —these are all types of user input. Earlier we looked at
parameters, such as how a user can specify options when calling a function
(i.e. coffee with milk and two sugars). This is an example of user input as
the user is specifying inputs to determine how the function will work.
One of the challenges of user inputs is that you cannot predict what a user
might do or what inputs a user might provide, and will need to prepare
responses for all possible outcomes.
Even a question that's simple to ask aloud becomes much more
complicated when you realize that you have to write a function that can
process all kinds of possible answers!

A ccou n tin g for user input


The "How Many Pets" function on the opposite page processes user input to
try to create the variable "answer" as an integer variable—meaning it should
answer the question "how many pets?" with a number. But it must account
for a wide variety of answer types in order to be effective. Imagine all the
things people could come up with:

36 // C O D I N G C O N C E P T S
^ Function: How Many Pets?

how many p e t s ? f| in p u t

if in p u t | ty p e = number

answer equals i nput


©
r e tu r n answer

e ls e i f | i nput ty p e = t e x t

if in p u t

I if
[
i nput
= 1 ©

I = 2

e l se answer = “ n o t g iv e n ” ©
r e tu r n answer ©

© First we check if the input is a number, and if so we return that value


as the answer.
© If not, we check if it is text, then try to convert that text to a number.
The function should be prepared for likely text answers.
© If the variable cannot be identified as either number or text, then the
function will return with the answer "not given."
© Note the paths always lead to the end, this way the function never
gets stuck and always completes.

C O D I N G C O N C E P T S // 37
CORE CO N CE PTS
I
D O N ' T REPEAT
Y O U R S E L F (DRY)

The phrase “don’t repeat yourself,” or DRY, is a key philosophy


for successful coding, meant to remind you to always reduce your
code to the simplest possible form.
One of the benefits of coding functions is their ability to repeat tasks,
meaning you don’t have to manually repeat the same request each time.
Making a smaller, repeatable code has a number of benefits that make
it easier for both you and the computer. First, the computer has less to
remember and will always reliably do the same thing. Also, because you
are writing less code, there is less risk of you making mistakes. Finally, it is
easier to make alterations to your code.
This also helps you build new things faster because you can include
functions you have already written rather than having to write everything
from scratch. The DRY philosophy is an important concept in coding
and we should always try to stick to it where possible. If you feel a task
is repeating the same steps frequently, that might be an indication that a
repeatable function could make your code more efficient.
Say you want to write out a function to buy snacks. If you are a snacker,
this could quite quickly get out of hand. For every snack item, you have to
go to the store, pick your snack, buy your snack, then come home—that's
four steps per snack!

38 // C O D I N G C O N C E P T S
N O W LET’S SIMPLIFY!
To simplify a repetitive function, ask yourself what its key components
are—what is accomplished? Then identify the pattern and which steps are
consistently being repeated.
In the example of a snack function, we are clearly looking to create a
function for buying food, and the steps in the process—such as going to
the store and looking for each item—apply equally to each separate food
item. Therefore the unique steps in the list can be reduced to the actual
snack items you want, for example:
1. Get a drink
2. Get a pizza
3. Get an ice cream

The ideal solution is a dynamic function, with the snack as a parameter.

"Buy a" function


Now, we can just call this buy a p ro d u c t
function and it will repeat the
tasks for the specified product. go t o th e s to re
If you were writing a function
for your whole day, you could fin d p ro d u c t
incorporate this function as
needed with minimal effort.
buy p ro d u c t

come home

REDUCE, REUSE, REFACTOR

The process of refining code by breaking it into smaller functions like this
is called code refactoring. Parents, it's a great idea to keep track of the new
vocabulary terms were learning and make a set of flashcards.

C O D I N G C O N C E P T S // 39
CORE C O N CE P T S

KEEP IT SIM P LE,


S T U P I D (KISS)
V
The phrase “keep it simple, stupid,” or KISS, is similar to DRY, but
is more focused on planning and problem solving.
Coding is a process of telling a computer to complete a task, and we should
always aim to do this in the shortest and simplest way. In the last section,
we saw how using a DRY philosophy can simplify our code, but if we plan
correctly from the start and use computational thinking, we can write
clean and simple code. Bear KISS in mind as you progress, to ensure that
your code is as straightforward and functional as possible.

The simplest "Set Age" function


Here we cut out the middle step of specifying possible answers, and directly
return the input as the age, meaning less chance of errors.

s e t age number

age

eq u als

number

age

40 // C O D I N G C O N C E P T S
0 The simplest "Find My Pet" function
We want to create a function to find my dog, "Spike." The first attempt
focuses on various details, and requires three parameters to be confirmed
to com e to a conclusion. The reduced option uses the quickest and easiest
function to solve the problem, based on the information we have available.
Since we know his name, let's just search for that. This function has been
simplified based on logic rather than tidying code.

fin d my p e t name

f o r each pet

if p e t: name = l name

answer
=L _.p e t 1
r e tu rn answer

C O D I N G C O N C E P T S // 41
CORE CONCEPTS
I

DEBUGGING

Debugging means investigating problems and trying to resolve


them, a sometimes frustrating—but essential—skill in coding.
The term debugging comes from the early days of computing when
machines were as big as entire rooms. Bugs would fly into the electronics
and break the machines, meaning people would need to remove the bugs
to fix it. Nowadays a bug means an error that stops your code working as
expected, and debugging is the process of fixing it.

Quite often, a bug is a combination of making a mistake in the code and


the computer doing the wrong thing (because it has been instructed to),
but there could also be a fault with the software or hardware that cannot
be fixed in the code. Debugging is the process of finding out where and
what the problem is.

Once you have checked for basic typos and errors in structure, if the code
still isn't behaving as expected, try asking yourself these questions:
1. What makes you think your code isn't working?
2. What did you expect your code to do and why?
3. What did your code do instead, and how do you know?

LEARN AS YOU GO KEY PO IN T

Your process of debugging might Every programmer, from beginner to


change each time depending on the expert level will spend a large portion
type of problem, but it is a valuable of their time debugging, so don’t feel
skill to be able to understand code frustrated by this step.
and interpret where mistakes might
be happening.

42 // C O D I N G C O N C E P T S
DEBUG G ING A SAMPLE F U N C T IO N
This function lets you input your age to see if you are old enough to watch
an R-rated movie, but it has wrongly allowed someone who is too young to
see the film. We need to debug the function!

^Jt Steps for d ebugging ( l) Check the output. The


fact we are receiving a
response means that

L_ 7_ l
some part of the function
© am I o ld enough? is working. If no response
was returned we would
suspect the problem to be
retu rn s true
a broken function flow.
© Test a different input. By
© am I o ld enough?
□ 20HI changing the input value
we can see if the response
changes. (If we test with
r e t u r n s TRUE an older age and receive
a no, we would know the
function is giving opposite
© am I o ld enough? age answers.)
(3) Read through the function
step-by-step to see what
© if L age J > 2 could be happening each
time—you might spot
what is going wrong.
answer = TRUE
( 4 ) Aha! It seems we have
Else entered the wrong
number to check against
I our age input. Let's change
it to 17
| return answer

Test. Now lets test our


function is working as
expected. It is! The bug
has been fixed.

C O D I N G C O N C E P T S // 43
CODE MANAGEMENT
J
V
W e have all the tools to begin coding, but need to bear in mind
how to maintain and manage this code.
When working on a project it's easy to get carried away and end up writing
a large amount of code. While this is not necessarily a problem, if you don't
keep it easy to read and understand, it can create problems later on, such
as incorporating errors. You may find it easier to break your code into
sections, making it more transparent and easier to check. You may also
want to write notes for yourself to help remind you what is happening in
your code.

0 Best practices
Take a look at the opposite page. This is our "Make a Drink" function from
page 29, but reduced and organized to its simplest form.
(T) Add comments: Most software will allow you to add comments to
functions so you can label different elements. This will not be read by
the computer or change the code, but will help you and other readers
to understand the code better.
(2) Give descriptive names: Another way to make it easy for you to
remember what the code does is with clear descriptive names for
your functions and variables. It is obvious the function "add milk" will
probably add the milk.
(3) Clean display: Another way to make code cleaner is with visual
spacing and indentation. This way we can see which functions
belong together This will not make the code any better in
functionality, but will make it easier for humans to use.
(4) Arrange by type: By putting similar sections together, we can easily
find the relevant part to work on. Here all the function calls are
grouped together, so we don't need to find where each call is being
made throughout the code.

44 // C O D I N G C O N C E P T S
0 W ell-m anaged code: "Make a Drink" function

//Function definition

© make a d r i n k typ e o p tio n sugar

b o il w a te r
I w a it 1 m in ute
if “ is i t h o t enough” eq u als f a ls e

make a d r i n k typ
ty p e □ c o p tio n sugar

e ls e pour in t o cup

c d r i nk
[ ty p e

© if o p tio n

add o p tio n

f | sugar

add sugar

s tir d r in k

r e tu rn d rin k
V ___ )
//Sample function calls

© make a d r i n k c o ffe e m ilk


> □

make a d r i n k te a m ilk

make d r i nk te a
° n

C O D I N G C O N C E P T S // 4S
C O M M O N C O D IN G ISSUES
J
v ------------------------------------------------------------------------------------

Here are a few mistakes coders often make while building


projects. Remember these errors to avoid potential pitfalls.

O I don't know what is causing the problem

You may find an issue with your code not working, but not know where
it’s happening. This might be a sign that your functions are too large and
complicated, and could use some simplification and refactoring. See page
40 for tips on keeping code simple.

My variable isn't recording the correct value

You may have used the same variable more than once. Variables need to
be kept unique or your code could become confused. Keep them distinctly
named and descriptive as to what information they hold. If your variable
isn't showing any information at all, you may have spelled it differently or
used spaces or capital letters, so your variables do not match throughout
the function.

46 // C O D I N G C O N C E P T S
© My function is not doing what I expected

You might find the outputs or results of your code are not working in the
way you wanted, meaning you have a bug in your code. Not to worry,
debugging is an essential skill to coding and is an opportunity to learn.
Looking at the result of your code may provide a clue as to what's wrong
with the code, see page 42 for more debugging advice.

My function isn't doing anything

Perhaps your code isn’t doing anything at all and there is no response when
you test it. This could be a number of things, but maybe it's simply because
it's coded to not do anything in some circumstances. It is important that
your functions are able to handle all outcomes as otherwise it will confuse
you by returning nothing. You must also be careful that your code doesn't
get trapped in never-ending loops and flows.

© There is no way to do what I want my code to do

You may become frustrated that you don't know how to solve a problem
or do something with code, and the problem may be you are limiting
yourself by what you know. If you feel you are devising overly elaborate or
complicated ways to do something, there may be a simpler way that you
are not aware of. It's important to keep learning and to challenge yourself
to find ways to simplify your code by researching other solutions.

C O D I N G C O N C E P T S // 47
TEST YOUR KNOWLEDGE
I
P R O J E C T 1:
FASHIONBOT

Time to test your understanding by developing a function to help


you choose what to wear.
We have covered many of the important concepts and skills for coding, but
now it's time to begin your own code thinking. Over the next few pages,
you will find projects which need adaptations and enhancements. The best
way to learn is by doing, so follow along with these challenges to design
your new functions.

FashionBot
Help find the ideal outfit with our new FashionBot function (opposite). This
function allows you to enter two parameters: the weather outside and your
destination, and returns the list variable "clothing," telling you what to wear
today. The function works so far, but requires some adjustments:
F a s h io n B o t[ra in , pa rk]
R eturns “ r a i n c o a t , rubber b o o ts "
F a s h io n B o t[d ry , s c h o o l]
R eturns “ school u n ifo rm , shoes”

FashionBot elem ents


0 Here we name our function and two parameters.
( 2) Here we use conditional flow to check for rain and set the clothes
variable.
(3) In the "else" section we give alternatives, so the variable "clothes' will
always be set and return something.
0 Finally, we return whatever the "clothes” is set to and end the function.

48 // C O D I N G C O N C E P T S
IMPROVE OUR FUNCTION

Draw out a copy of this function, but add these changes to make it better:
• Add new conditions for if weather is equal to "sunny" and add
sunglasses to the "clothes" list variable.
• Add a new third parameter for hat, if hat is equal to true and
destination is not equal to school then add hat to the list variable
"clothes."
• Add an option that if destination is equal to "stay home" then return
only "pajamas" as the variable "clothes."

C O D I N G C O N C E P T S // 49
TEST YOUR KNOWLEDGE

P R O J E C T 2:
FIN D THE W IZ A R D

Another challenge for your functional thinking, help us find the


right wizard!
On the opposite page, you will find a collection of cards detailing three
wizards. Each has a name, special power, and may or may not use dark
magic. We built a function to retrieve the correct wizard based on their
power, but some customizations would really help!

Q l Wizard function elements


Here we name our function and single parameters.
©
© Here we loop through the wizards to check if their power matches the
one requested. If we find a match, we set the 'answer" variable and
return it to end the function.
© If the power requested cannot be matched, we simply set the "answer"
variable to "not found" and return that instead.

IMPROVE OUR FU NC TIO N

Again, draw a copy of this function with these changes to make it better:
• Create a new wizard to be included in our list. Give them a name and
power and set their dark magic to true or false. What function would
you need to call to retrieve your wizard?
• Imagine there were two wizards with the same power—can you find
a way to search for the wizard by name instead?
• We don't want our function to allow wizards with dark magic
anymore, so if the wizard found has dark magic set to true, then
instead set your "answer" variable to "not allowed."

50 // C O D I N G C O N C E P T S
name: G l i n d o r name: N o i r i n
power: Ic e power: Earth
dark magic: f a l s e da rk magic: t r u e

C O D I N G C O N C E P T S // 51

L
Other documents randomly have
different content
from what has been the case with any of the previously considered
mechanisms. The tangible manifestation of energy which we term
heat is not merely a condition of action and a by-product, as it was
in the case of the animal machine; it is the essential factor upon
which all the efficiency of the mechanism depends.
It should perhaps be stated that this explanation of the action of
the steam engine is a comparatively modern scientific interpretation.
The earlier experimenters brought the steam engine to a high state
of efficiency, without having any such conception as this of the
nature of steam itself. For practical purposes it suffices to note that
water when heated takes the form of steam; that this steam has the
property of powerful and indefinite expansion; and thirdly, that when
allowed to escape from a state of pressure, sudden expansion of the
steam cools it sufficiently to cause the recondensation of part of its
substance, thus creating a vacuum.
Stated in few words, the entire action of the steam depends upon
these simple mechanical principles. The principles are practically
applied by permitting the steam to enter the cylinder where it can
act on a piston, to which it gives the thrust that is transmitted to an
external mechanism by means of a rod attached to the piston. When
the piston has been driven to the end of the desired thrust, the valve
is opened automatically, permitting the steam to escape, thus
producing a vacuum, and insuring the return thrust of the piston,
which is further facilitated, ordinarily, by the admission of steam to
the other side of the piston. Practical operation of this mechanism is
familiar to everyone, though the marvel of its power and efficiency
seems none the less because of its familiarity.
It is not too much to say that this relatively simple device, in its
first general application, marked one of the most important turning
points in the history of civilization. To its influence, more than to any
other single cause, must be ascribed the revolutionary change that
came over the character of practical life in the nineteenth century.
From prehistoric times till well toward the close of the eighteenth
century, there was scarcely any important change in carrying out the
world's work. And in the few generations that have since elapsed,
the entire aspect of the mechanical world has been changed, the
working efficiency of the individual has been largely increased;
mechanical tasks have become easy which hitherto were scarcely
within the range of human capacity.
Before we go on to the detailed study of the machine which has
produced these remarkable results, it is desirable to make inquiry as
to the historical development of so important an invention.
The practical steam engine in its modern form dates, as just
mentioned, from the latter part of the eighteenth century, and was
perfected by James Watt, who is commonly thought of as being its
inventor. In point of fact, however, the history of most inventions is
duplicated here, as on examination it appears that various
forerunners of Watt had been on the track of the steam engine, and
some of them, indeed, had produced a workable machine of no
small degree of efficiency.
The very earliest experiments were made away back in the
Alexandrian days in the second century before the Christian era, the
experimenter being the famous Hero, whose work in an allied field
was referred to in the preceding chapter. Hero produced—or at least
described and so is credited with producing, though the actual
inventor may have been Ctesibius—a little toy mechanism, in which
a hollow ball was made to revolve on an axis through the agency of
steam, which escaped from two bent tubes placed on opposite sides
of the ball, their orifices pointing in opposite directions. The
apparatus had no practical utility, but it sufficed to establish the
principle that heat, acting through the agency of steam, could be
made to do mechanical work. Had not the age of Hero been a time
of mental stasis, it is highly probable that the principle he had thus
demonstrated would have been applied to some more practical
mechanism in succeeding generations. As it was, however, nothing
practical came of his experiment, and the steam turbine engine was
remembered only as a scientific toy.
No other worker continued the experiments, so far as is known,
until the time of the great Italian, Leonardo da Vinci, who, late in the
fifteenth century, gave a new impulse to mechanical invention.
Leonardo experimented with steam, and succeeded in producing
what was virtually an explosion engine, by the agency of which a
ball was propelled along the earth. But this experiment also failed to
have practical result.

BEGINNINGS OF MODERN DISCOVERY

Such sporadic experiments as these have no sequential connection


with the story of the evolution of the steam engine. The experiments
which led directly on to practical achievements were not begun until
the seventeenth century. In the very first year of that century, an
Italian named Giovanni Battista della Porta published a treatise on
pneumatics, in which the idea of utilizing steam for the practical
purpose of raising water was expressly stated. The idea of this
inventor was put into effect in 1624 by a French engineer and
mathematician, Solomon de Caus. He invented two different
machines, the first of which required a spherical boiler having an
internal tube reaching nearly to the bottom; a fire beneath the boiler
produced steam which would force the water in the boiler to a
height proportional to the pressure obtained. In the other machine,
steam is led from the boiler into the upper part of a closed cistern
containing water to be elevated. To the lower portion of the cistern a
delivery pipe was attached so that water was discharged under a
considerable pressure. This arrangement was precisely similar to the
apparatus employed by Hero of Alexandria in various of his
fountains, as regards the principle of expanding gas to propel water.
An important difference, however, consists in the fact that the
scheme of della Porta and of de Caus embodied the idea of
generating pressure with the aid of steam, whereas Hero had
depended merely on the expansive property of air compressed by
the water itself.
While these mechanisms contained the germ of an idea of vast
importance, the mechanisms themselves were of trivial utility. It is
not even clear whether their projectors had an idea of the properties
of the condensation of vapor, upon which the working of the
practical steam engine so largely depends. This idea, however, was
probably grasped about half a century later by an Englishman,
Edward Somerset, the celebrated Marquis of Worcester, who in 1663
described in his Century of Inventions an apparatus for raising water
by the expansive force of steam. His own account of his invention is
as follows:
"An admirable and most forcible way to drive up water by fire; not
by drawing or sucking it upwards, for that must be as the
philosopher calleth it, intra sphæram activitatis, which is but at such
a distance. But this way hath no bounder, if the vessel be strong
enough: for I have taken a piece of whole cannon, whereof the end
was burst, and filled it three-quarters full of water, stopping and
screwing up the broken end, as also the touch-hole; and making a
constant fire under it, within twenty-four hours it burst and made a
great crack; so that having a way to make my vessels so that they
are strengthened by the force within them, and the one to fill after
the other, I have seen the water run like a constant stream, forty
feet high: one vessel of water, rarefied by fire, driveth up forty of
cold water; and the man that tends the work is but to turn two
cocks, that one vessel of water being consumed, another begins to
force and refill with cold water, and so successively; the fire being
tended and kept constant, which the self-same person may likewise
abundantly perform in the interim, between the necessity of turning
the said cocks."
It is unfortunate that the Marquis did not give a more elaborate
description of this remarkable contrivance. The fact that he treats it
so casually is sufficient evidence that he had no conception of the
possibilities of the mechanism; but, on the other hand, his
description suffices to prove that he had gained a clear notion of,
and had experimentally demonstrated, the tremendous power of
expansion that resides in steam. No example of his steam pump has
been preserved, and historians of the subject have been left in doubt
as to some details of its construction, and in particular as to whether
it utilized the principle of a vacuum created through condensation of
the steam.

THOMAS SAVERY'S STEAM PUMP

This principle was clearly grasped, however, by another


Englishman, Thomas Savery, a Cornish mine captain, who in 1698
secured a patent for a steam engine to be applied to the raising of
water, etc. A working model of this machine was produced before
the Royal Society in 1699. The transactions of the Society contain
the following: "June 14th, 1699, Mr. Savery entertained the Royal
Society with showing a small model of his engine for raising water by
help of fire, which he set to work before them: the experiment
succeeded according to expectation, and to their satisfaction."
The following very clear description of Savery's engine is given in
the introduction to Beckmann's History of Inventions:
"This engine, which was used for some time to a considerable
extent for raising water from mines, consisted of a strong iron vessel
shaped like an egg, with a tube or pipe at the bottom, which
descended to the place from which the water was to be drawn, and
another at the top, which ascended to the place to which it was to
be elevated. This oval vessel was filled with steam supplied from a
boiler, by which the atmospheric air was first blown out of it. When
the air was thus expelled and nothing but pure steam left in the
vessel, the communication with the boiler was cut off, and cold
water poured on the external surface. The steam within was thus
condensed and a vacuum produced, and the water drawn up from
below in the usual way by suction. The oval vessel was thus filled
with water; a cock placed at the bottom of the lower pipe was then
closed, and steam was introduced from the boiler into the oval
vessel above the surface of the water. This steam being of high
pressure, forced the water up the ascending tube, from the top of
which it was discharged, and the oval vessel being thus refilled with
steam, the vacuum was again produced by condensation, and the
same process was repeated. By using two oval steam vessels, which
would act alternately—one drawing water from below, while the
other was forcing it upwards, an uninterrupted discharge of water
was produced. Owing to the danger of explosion, from the high
pressure of the steam which was used, and from the enormous
waste of heat by unnecessary condensation, these engines soon fell
into disuse."

THOMAS SAVERY'S STEAM ENGINE.


The principle involved is that of the
expansion of steam exerting a propulsive
force and its subsequent condensation to
produce a vacuum. These are the principles
employed in the modern steam engine, but
the only use to which they were put in
Savery's engine was the elevation of water
by suction.
This description makes it obvious that Savery had the clearest
conception of the production of a vacuum by the condensation of
steam, and of the utilization of the suction thus established (which
suction, as we know, is really due to the pressure of outside air) to
accomplish useful work. Savery also arranged this apparatus in
duplicate, so that one vessel was filling with water while the other
was forcing water to the delivery pipe. This is credited with being
the first useful apparatus for raising water by the combustion of fuel.
There was a great waste of steam, through imparting heat to the
water, but the feasibility of the all-important principle of
accomplishing mechanical labor with the aid of heat was at last
demonstrated.
As yet, however, the experimenters were not on the track of the
method by which power could be advantageously transferred to
outside machinery. An effort in quite another direction to accomplish
this had been made as early as 1629 by Giovanni Branca, an Italian
mathematician, who had proposed to obtain rotary motion by
allowing a jet of steam to blow against the vanes of a fan wheel,
capable of turning on an axis. In other words, he endeavored to
utilize the principle of the windmill, the steam taking the place of
moving air. The idea is of course perfectly feasible, being indeed
virtually that which is employed in the modern steam turbine; but to
put the idea into practise requires special detailed arrangements of
steam jet and vanes, which it is not strange the early inventor failed
to discover. His experiments appear not to have been followed up by
any immediate successor, and nothing practical came of them, nor
was the principle which he had attempted to utilize made available
until long after a form of steam engine utilizing another principle for
the transmission of power had been perfected.

DENIS PAPIN INVENTS THE PISTON ENGINE

The principle in question was that of causing expanding steam to


press against a piston working tightly in a cylinder, a principle, in
short, with which everyone is familiar nowadays through its
utilization in the ordinary steam engine. The idea of making use of
such a piston appears to have originated with a Frenchman, Denis
Papin, a scientific worker, who, being banished from his own country,
was established as professor of mathematics at the University of
Marburg. He conceived the important idea of transmitting power by
means of a piston as early as 1688, and about two years later added
the idea of producing a vacuum in a cylinder, by cooling the cylinder,
—the latter idea being, as we have just seen, the one which Savery
put into effect.
DIAGRAMS OF EARLY ATTEMPTS TO UTILIZE
THE POWER OF STEAM.
Two attempts to give rotation to a mechanical
apparatus through the action of heated air or
steam. Nothing practical came of either effort,
but the mechanisms depicted are of historical
interest.
It will be noted that Papin's invention antedated that of Savery; to
the Frenchman, therefore, must be given the credit of hitting upon
two important principles which made feasible the modern steam
engine. Papin constructed a model consisting of a small cylinder in
which a solid piston worked. In the cylinder beneath the piston was
placed a small quantity of water, which, when the cylinder was
heated, was turned into steam, the elastic force of which raised the
piston. The cylinder was then cooled by removing the fire, when the
steam condensed, thus creating a vacuum in the cylinder, into which
the piston was forced by the pressure of the atmosphere.
Such an apparatus seems crude enough, yet it incorporates the
essential principles, and required but the use of ingenuity in
elaborating details of the mechanism, to make a really efficient
steam engine. It would appear, however, that Papin was chiefly
interested in the theoretical, rather than in the really practical side of
the question, and there is no evidence of his having produced a
working machine of practical power, until after such machines
worked by steam had been constructed elsewhere.

THOMAS NEWCOMEN'S IMPROVED ENGINE

As has happened so often in other fields, Englishmen were the


first to make practical use of the new ideas. In 1705 Thomas
Newcomen, a blacksmith or ironmonger, and John Cawley, a plumber
and glazier, patented their atmospheric engine, and five years later,
in the year 1710, namely, Newcomen had on the market an engine
which is described in the Report of the Department of Science and
Arts of the South Kensington Museum, as "the first real pumping
engine ever made."
The same report describes the engine as "a vertical steam cylinder
provided with a piston connected at one end of the beam, having a
pivot or bearing in the middle of its length, and at the other end of
the beam pump rods for working the pump. The cylinder was
surrounded by a second cylinder or jacket, open at the top, and cold
water could be supplied to this outer cylinder at pleasure. The single
or working cylinder could be supplied with steam when desired from
a boiler below it. There was a drain pipe from the bottom of the
working cylinder, and one from the outer cylinder. For the working of
the engine steam was admitted to the working cylinder, so as to fill it
and expel all the air, the piston then being at the top, owing to the
weight of the pump rods being sufficient to lift it; then the steam
was shut off and the drain cocks closed and cold water admitted to
the outer cylinder, so that the steam in the working cylinder
condensed, and, leaving a partial vacuum of pressure of the
atmosphere, forced the piston down and drew up the pump rods,
thus making a stroke of the pump. Then the water was drawn off
from the outer cylinder and steam admitted to the working cylinder
before allowing the piston to return to the top of its stroke, ready for
the next down stroke."
It will be observed that this machine adopts the principle, with
only a change of mechanical details, of the Papin engine just
described. A later improvement made by Newcomen did away with
the outer cylinder for condensing the steam, employing instead an
injection of cold water into the working cylinder itself, thus enabling
the engine to work more quickly. It is said that the superiority of the
internal condensing arrangement was accidentally discovered
through the improved working of an engine that chanced to have an
exceptionally leaky piston or cylinder. Many engines were made on
this plan and put into practical use.
Another important improvement was made by a connection from
the beam to the cocks or valves, so that the engine worked
automatically, whereas in the first place it had been necessary to
have a boy or man operate the valves,—a most awkward
arrangement, in the light of modern improvements. As the story is
told, the duty of opening and closing the regulating and condensing
valves was intrusted to boys called cock boys. It is said that one of
these boys named Humphrey Potter "wishing to join his comrades at
play without exposing himself to the consequences of suspending
the performance of the engine, contrived, by attaching strings of
proper length to the levers which governed the two cocks, to
connect them with the beam, so that it should open and close the
cocks as it moved up and down with the most perfect regularity."
This story has passed current for almost two centuries, and it has
been used to point many a useful moral. It seems almost a pity to
disturb so interesting a tradition, yet it must have occurred to more
than one iconoclast that the tale is almost too good to be true. And
somewhat recently it has been more than hinted that Desaguliers,
with whom the story originated, drew upon his imagination for it. A
print is in existence, made so long ago as 1719, representing an
engine erected by Newcomen at Dudley Castle, Staffordshire, in
1712, in which an automatic valve gear is clearly shown, proving
that the Newcomen engine was worked automatically at this early
period. That the admirable story of the inventive youth, whose wits
gave him leisure for play, may not be altogether discredited,
however, it should be added that unquestionably some of the early
engines had a hand-moved gear, and that at least one such was still
working in England after the middle of the nineteenth century. It
seems probable, then, that the very first engines were without the
automatic valve gear, and there is no inherent reason why a quick-
witted youth may not have been the first to discover and remedy the
defect.
According to the Report of the Department of Science and Arts of
the South Kensington Museum: "The adoption of Newcomen's
engine was rapid, for, commencing in 1711 with the engine at
Wolverhampton, of twenty-three inch diameter and six foot stroke,
they were in common use in English collieries in 1725; and Smeaton
found in 1767 that, in the neighborhood of Newcastle alone there
were fifty-seven at work, ranging in size from twenty-eight inch to
seventy-five inch cylinder diameter, and giving collectively about
twelve hundred horse-power. As Newcomen obtained an evaporation
of nearly eight pounds of water per pound of coal, the increase of
boiler efficiency since his time has necessarily been but slight,
although in other requisites of the steam generator great
improvements are noticeable."
A MODEL OF THE NEWCOMEN
ENGINE.
This engine has particular interest
not only because it was a practical
pumping engine, but also because it
was while repairing an engine of this
type that Watt was led to the
experiments that resulted in his epoch-
making discovery.
THE COMING OF JAMES WATT

The Newcomen engine had low working efficiency as compared


with the modern engine; nevertheless, some of these engines are
still used in a few collieries where waste coal is available, the
pressure enabling the steam to be generated in boilers unsafe for
other purposes. The great importance of the Newcomen engine,
however, is historical; for it was while engaged in repairing a model
of one of these engines that James Watt was led to invent his plan
of condensing the steam, not in the working cylinder itself, but in a
separate vessel,—the principle upon which such vast improvements
in the steam engine were to depend.
It is impossible to overestimate the importance of the work which
Watt accomplished in developing the steam engine. Fully to
appreciate it, we must understand that up to this time the steam
engine had a very limited sphere of usefulness. The Newcomen
engine represented the most developed form, as we have seen; and
this, like the others that it had so largely superseded, was employed
solely for the pumping of water. In the main, its use was confined to
mines, which were often rendered unworkable because of flooding.
We have already seen that a considerable number of engines were
in use, yet their power in the aggregate added but a trifle to man's
working efficiency, and the work that they did accomplish was done
in a most uneconomical manner. Indeed the amount of fuel required
was so great as to prohibit their use in many mines, which would
have been valuable could a cheaper means have been found of
freeing them from water. Watt's inventions, as we shall see,
accomplished this end, as well as various others that were not
anticipated.
It was through consideration of the wasteful manner of action of
the steam engine that Watt was led to give attention to the subject.
The great inventor was a young man at the University of Glasgow.
He had previously served an apprenticeship of one year with a
maker of philosophical instruments in London, but ill health had
prevented him from finishing his apprenticeship, and he had
therefore been prohibited from practising his would-be profession in
Glasgow. Finally, however, he had been permitted to work under the
auspices of the University; and in due course, as a part of his official
duties, he was engaged in repairing a model of the Newcomen
engine. This incident is usually mentioned as having determined the
line of Watt's future activity.
It should be recalled, however, that Watt had become a personal
friend of the celebrated Professor Black, the discoverer of latent
heat, and the foremost authority in the world, in this period, on the
study of pneumatics. Just what share Black had in developing Watt's
idea, or in directing his studies toward the expansive properties of
steam, it would perhaps be difficult to say. It is known, however,
that the subject was often under discussion; and the interest evinced
in it by Black is shown by the fact that he subsequently wrote a
history of Watt's inventions.
It is never possible, perhaps, for even the inventor himself to re-
live the history of the growth of an idea in his own mind. Much less
is it possible for him to say precisely what share of his progress has
been due to chance suggestions of others. But it is interesting, at
least, to recall this association of Watt with the greatest
experimenter of his age in a closely allied field. Questions of
suggestion aside, it illustrates the technical quality of Watt's mind,
making it obvious that he was no mere ingenious mechanic, who
stumbled upon his invention. He was, in point of fact, a carefully
trained scientific experimenter, fully equipped with all the special
knowledge of his time in its application to the particular branch of
pneumatics to which he gave attention.
The first and most obvious defect in the Newcomen engine was,
as Watt discovered, that the alternating cooling and heating of the
cylinder resulted in an unavoidable waste of energy. The apparatus
worked, it will be recalled, by the introduction of steam into a
vertical cylinder beneath the piston, the cylinder being open above
the piston to admit the air. The piston rod connected with a beam
suspended in the middle, which operated the pump, and which was
weighted at one end in order to facilitate the raising of the piston.
The steam, introduced under low pressure, scarcely more than
counteracted the pressure of the air, the raising of the piston being
largely accomplished by the weight in question.
Of course the introduction of the steam heated the cylinder. In
order to condense the steam and produce a vacuum, water was
injected, the cylinder being thereby cooled. A vacuum being thus
produced beneath the cylinder, the pressure of the air from above
thrust the cylinder down, this being the actual working agent. It was
for this reason that the Newcomen engine was called, with much
propriety, a pneumatic engine. The action of the engine was very
slow, and it was necessary to employ a very large piston in order to
gain a considerable power.
The first idea that occurred to Watt in connection with the
probable improvement of this mechanism did not look to the
alteration of any of the general features of the structure, as regards
size or arrangement of cylinder, piston, or beam, or the essential
principle upon which the engine worked. His entire attention was
fixed on the discovery of a method by which the loss of heat through
periodical cooling of the cylinder could be avoided. We are told that
he contemplated the subject long, and experimented much, before
he reached a satisfactory solution. Naturally enough his attention
was first directed toward the cylinder itself. He queried whether the
cylinder might not be made of wood, which, through its poor
conduction of heat, might better equalize the temperature.
Experiments in this direction, however, produced no satisfactory
result.
WATT'S EARLIEST TYPE OF PUMPING ENGINE.
The lower figure shows the ruins of Watt's famous
engine "Old Bess." The upper figure shows a reconstructed
model of the "Old Bess" engine. It will be noted that the
walking beam is precisely of the Newcomen type. In fact,
the entire engine is obviously only a modification of the
Newcomen engine. It had, however, certain highly
important improvements, as described in the text.
Then at last an inspiration came to him. Why not connect the
cylinder with another receptacle, in which the condensation of the
steam could be effected? The idea was a brilliant one, but neither its
originator nor any other man of the period could possibly have
realized its vast and all-comprehending importance. For in that idea
was contained the germ of all the future of steam as a motive
power. Indeed, it scarcely suffices to speak of it as the germ merely;
the thing itself was there, requiring only the elaboration of details to
bring it to perfection.
Watt immediately set to work to put his brilliant conception of the
separate condenser to the test of experiment. He connected the
cylinder of a Newcomen engine with a receptacle into which the
steam could be discharged after doing its work on the piston. The
receptacle was kept constantly cooled by a jet of water, this water
and the water of condensation, together with any air or
uncondensed steam that might remain in the receptacle, being
constantly removed with the aid of an air pump. The apparatus at
once demonstrated its practical efficiency,—and the modern steam
engine had come into existence.
It was in the year 1765, when Watt was twenty-nine years old,
that he made his first revolutionary experiment, but his first patents
were not taken out until 1769, by which time his engine had attained
a relatively high degree of perfection. In furthering his idea of
keeping the cylinder at an even temperature, he had provided a
covering for it, which might consist of wood or other poorly
conducting material, or a so-called jacket of steam—that is to say, a
portion of steam admitted into the closed chamber surrounding the
cylinder. Moreover, the cylinder had been closed at the top, and a
portion of steam admitted above the piston, to take the place of the
atmosphere in producing the down stroke. This steam above the
piston, it should be explained, did not connect with the condensing
receptacle, so the engine was still single-acting; that is to say it
performed work only during one stroke of the piston. A description
of the mechanism at this stage of its development may best be given
in the words of the inventor himself, as contained in his
specifications in the application for patent on his improvements in
1769.
"My method of lessening the consumption of steam, and
consequently fuel, in fire-engines, consists of the following
principles:
"First, That vessel in which the powers of steam are to be
employed to work the engine, which is called the cylinder in common
fire-engines, and which I call the steam vessel, must, during the
whole time the engine is at work, be kept as hot as the steam that
enters it; first by enclosing it in a case of wood, or any other
materials that transmit heat slowly; secondly, by surrounding it with
steam or other heated bodies; and, thirdly, by suffering neither
water nor any other substance colder than the steam to enter or
touch it during that time.
"Secondly, In engines that are to be worked wholly or partially by
condensation of steam, the steam is to be condensed in vessels
distinct from the steam vessels or cylinders, although occasionally
communicating with them; these vessels I call condensers; and,
whilst the engines are working, these condensers ought at least to
be kept as cold as the air in the neighborhood of the engines, by
application of water or other cold bodies.
"Thirdly, Whatever air or other elastic vapor is not condensed by
the cold of the condenser, and may impede the working of the
engine, is to be drawn out of the steam vessels or condensers by
means of pumps, wrought by the engines themselves, or otherwise.
"Fourthly, I intend in many cases to employ the expansive force of
steam to press on the pistons, or whatever may be used instead of
them, in the same manner in which the pressure of the atmosphere
is now employed in common fire-engines. In cases where cold water
can not be had in plenty, the engines may be wrought by this force
of steam only, by discharging the steam into the air after it has done
its office.
"Sixthly, I intend in some cases to apply a degree of cold not
capable of reducing the steam to water, but of contracting it
considerably, so that the engines shall be worked by the alternate
expansion and contraction of the steam.
"Lastly, Instead of using water to render the pistons and other
parts of the engine air-and steam-tight, I employ oils, wax, resinous
bodies, fat of animals, quicksilver and other metals in their fluid
state."

ROTARY MOTION

It must be understood that Watt's engine was at first used


exclusively as an apparatus for pumping. For some time there was
no practical attempt to apply the mechanism to any other purpose.
That it might be so applied, however, was soon manifest, in
consideration of the relative speed with which the piston now acted.
It was not until 1781, however, that Watt's second patent was taken
out, in which devices are described calculated to convert the
reciprocating motion of the piston into motion of rotation, in order
that the engine might drive ordinary machinery.
It seems to be conceded that Watt was himself the originator of
the idea of making the application through the medium of a crank
and fly-wheel such as are now universally employed. But the year
before Watt took out his second patent, another inventor named
James Picard had patented this device of crank and connecting rod,
having, it is alleged, obtained the idea from a workman in Watt's
employ. Whatever be the truth as to this point, Picard's patent made
it necessary for Watt to find some alternative device, and after
experimenting, he hit upon the so-called sun and planet gearing,
and henceforth this was used on his rotary engines until the time for
the expiration of Picard's patent, after which the simpler and more
satisfactory crank and fly-wheel were adopted.
In the meantime, Watt had associated himself with a business
partner named Boulton, under the firm name of Boulton and Watt.
In 1776 a special act of legislation extending the term of Watt's
original patent for a period of twenty-five years had been secured.
All infringements were vigorously prosecuted, and the inventor, it is
gratifying to reflect, shared fully in the monetary proceeds that
accrued from his invention.
WATT'S ROTATIVE ENGINE.
The lower figure shows the earliest type of mechanism
through which Watt applied his engine to other uses than
that of pumping. The so-called sun-and-planet gearing,
through which rotary motion was attained, is seen at the
lower right-hand corner of the figure. The upper figure
shows a later and much improved type of the Watt engine,
in which the sun-and-planet gearing has been supplanted
by a simple crank.
Notwithstanding the early recognition of the possibility of securing
rotary motion with Watt's perfected Newcomen engine, it was long
before the full possibilities of the application of this principle were
realized, even by the most practical of machinists. Watt himself
apparently appreciated the possibilities no more fully than the
others, as the use of his famous engines "Beelzebub" and "Old Bess"
in the establishment of Boulton and Watt amply testifies. It appears
that Boulton had been an extensive manufacturer of ornamental
metal articles. To drive his machinery at Soho he employed two large
water wheels, twenty-four feet in diameter and six feet wide. These
sufficed for his purpose under ordinary conditions, but in dry
weather from six to ten horses were required to aid in driving the
machinery. When Watt's perfected engine was available, however,
this was utilized to pump water from the tail race back to the head
race, that it might be used over and over. "Old Bess" had a cylinder
thirty-three inches in diameter with seven-foot stroke, operating a
pump twenty-four inches in diameter; it therefore had remarkable
efficiency as a pumping apparatus. But of course it utilized, at best,
only a portion of the working energy contained in the steam; and
the water wheels in turn could utilize not more than fifty per cent. of
the store of energy which the pump transferred to the water in
raising it. Therefore, such use of the steam engine involved a most
wasteful expenditure of energy.
It was long, however, before the practical machinists could be
made to believe that the securing of direct rotary power from the
piston could be satisfactorily accomplished. It was only after the
introduction of higher speed and heavier fly-wheels, together with
improved governors, that the speed of rotation was so equalized as
to meet satisfactorily the requirements of the practical engineer, and
ultimately to displace the wasteful method of securing rotary motion
indirectly through the aid of pump and water wheel. It may be
added, that the centrifugal governor, with which modern engines are
provided to regulate their speed, was the invention of Watt himself.

FINAL IMPROVEMENTS AND MISSED OPPORTUNITIES

In the year 1782 Watt took out patents which contained


specifications for the two additional improvements that constituted
his final contribution to the production of the steam engine. The first
of these provided for the connection of the cylinder chamber on
each side of the piston with the condenser, so that the engine
became double acting. The second introduced the very important
principle,—from the standpoint of economy in the use of steam—of
shutting off the supply of steam from the cylinder while the piston
has only partially traversed its thrust, and allowing the remainder of
the thrust to be accomplished through the expansion of the steam.
The application of the first of these principles obviously adds greatly
to the efficiency of the engine, and in practise it was found that the
application of the second principle produces a very great saving in
steam, and thus adds materially to the economical working of the
engine.
All of Watt's engines continued to make use of the walking beam
attached to the piston for the transmission of power; and engineers
were very slow indeed to recognize the fact that in many—in fact in
most—cases this contrivance may advantageously be done away
with. The recognition of this fact constitutes one of the three really
important advances that have been made in the steam engine since
the time of Watt. The other two advances consist of the utilization of
steam under high pressure, and of the introduction of the principle
of the compound engine.
Neither of these ideas was unknown to Watt, since the utilization
of steam under high pressure was advocated by his contemporary,
Trevithick, while the compound engine was invented by another
contemporary named Hornblower. Perhaps the very fact that these
rival inventors put forward the ideas in question may have influenced
Watt to antagonize them; in particular since his firm came into legal
conflict with each of the other inventors. At any rate, Watt continued
to the end of his life to be an ardent advocate of low pressure for
the steam engine, and his firm even attempted to have laws passed
making it illegal—on the ground of danger to human life—to utilize
high-pressure steam, such as employed by Trevithick.
Possibly the conservatism of increasing age may also have had its
share in rendering Watt antagonistic to the new ideas; for he was
similarly antagonistic to the idea of applying steam to the purposes
of locomotion. Trevithick, among others, had, as we shall see in due
course, made such application with astonishing success, producing a
steam automobile which traversed the highway successfully. In his
earlier years Watt had conceived the same idea, and had openly
expressed his opinion that the steam engine might be used for this
purpose. But late in life he was so antipathetic to the idea that he is
said to have put a clause in the lease of his house, providing that no
steam carriage should under any pretext be allowed to approach it.
These incidents have importance as showing—as we shall see
illustrated again and again in other fields—the disastrous influence in
retarding progress that may be exercised by even the greatest of
scientific discoverers, when authority well earned in earlier years is
exercised in an unfortunate direction later in life. But such incidents
as these are inconsequential in determining the position among the
world's workers of the man who was almost solely responsible for
the transformation of the steam engine from an expensive and
relatively ineffective pumping apparatus, to the great central power
that has ever since moved the major part of the world's machinery.

THE SUPREME IMPORTANCE OF WATT

It is speaking well within bounds to say that no other invention


within historical times has had so important an influence upon the
production of property—which, as we have seen, is the gauge of the
world's work—as this invention of the steam engine. We have
followed the history of that invention in some detail, because of its
supreme importance. To the reader who was not previously familiar
with that history, it may seem surprising that after a lapse of a little
over a century one name and one alone should be popularly
remembered in connection with the invention; whereas in point of
fact various workers had a share in the achievement, and the man
whose name is remembered was among the last to enter the field.
We have seen that the steam engine existed as a practical working
machine several decades before Watt made his first invention; and
that what Watt really accomplished was merely the perfecting of an
apparatus which already had attained a considerable measure of
efficiency.
There would seem, then, to be a certain lack of justice in ascribing
supreme importance to Watt in connection with the steam engine.
Yet this measure of injustice we shall find, as we examine the history
of various inventions, to be meted always by posterity in determining
the status of the men whom it is pleased to honor. One practical
rule, and one only, has always determined to whom the chief share
of glory shall be ascribed in connection with any useful invention.
The question is never asked as to who was the originator of the
idea, or who made the first tentative efforts towards its utilization,—
or, if asked by the historical searcher, it is ignored by the generality
of mankind.
So far as the public verdict, which in the last resort determines
fame, is concerned, the one question is, Who perfected the
apparatus so that it came to have general practical utility? It may be,
and indeed it usually is the case, that the man who first
accomplished the final elaboration of the idea, made but a
comparatively slight advance upon his predecessors; the early
workers produced a machine that was almost a success; only some
little flaw remained in their plans. Then came the perfecter, who hit
upon a device that would correct this last defect,—and at last the
mechanism, which hitherto had been only a curiosity, became a
practical working machine.
In the case of the steam engine, it might be said that even a
smaller feat than this remained to be accomplished when Watt came
upon the scene; since the Newcomen engine was actually a practical
working apparatus. But the all-essential thing to remember is that
this Newcomen engine was used for a single purpose. It supplied
power for pumping water, and for nothing else. Neither did it have
possibilities much beyond this, until the all-essential modification
was suggested by Watt, of exhausting its steam into exterior space.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like