CODING
CUTTING-EDGE TECHNOLOGY
by Angie Smibert
ALL ABOUT
CODING
by Angie Smibert
ABOUT THE AUTHOR
Angie Smibert is the author of several young adult science fiction novels, including the
Memento Nora series, numerous short stories, and many educational titles. She was also a
writer and web developer at NASAs Kennedy Space Center for many years.
www.northstareditions.com
Copyright 2017 by North Star Editions, Lake Elmo, MN 55042. All rights reserved. No
part of this book may be reproduced or utilized in any form or by any means without written
permission from the publisher.
Produced for North Star Editions by Red Line Editorial.
Photographs : Rawpixel.com/Shutterstock Images, cover, 1, 1415, 23; OlegDoroshin/
Shutterstock Images, 45; Fine Art Images Heritage Images/Newscom, 7; Everett
Historical/Shutterstock Images, 9; Johan Swanepoel/Shutterstock Images, 1011; Red
Line Editorial, 13; michaeljung/Shutterstock Images, 17; Scratch: Scratch is developed by
the Lifelong Kindergarten Group at the MIT Media Lab. See http://scratch.mit.edu., 1819;
eakkaluktemwanich/Shutterstock Images, 2021; Jason Ogulnik/picture-alliance/dpa/AP
Images, 2425; Tony Avelar/AP Images, 27; Shizuo Kambayashi/AP Images, 29
Content Consultant: Jeffrey Miller, Associate Professor of Engineering Practice, Department
of Computer Science, University of Southern California
ISBN
978-1-63517-011-5 (hardcover)
978-1-63517-067-2 (paperback)
978-1-63517-172-3 (ebook pdf)
978-1-63517-122-8 (hosted ebook)
Library of Congress Control Number: 2016949760
Printed in the United States of America
Mankato, MN
November, 2016
978-1-68444-290-4 (e-book)
Synched Read-Along Version by:
Triangle Interactive LLC
PO Box 573
Prior Lake, MN 55372
TABLE OF CONTENTS
CHAPTER 1
Your First Code
CHAPTER 2
How Coding Works
CHAPTER 3
Thinking Like a Coder
HOW IT WORKS
Programming an Event
CHAPTER 4
Avoiding Dangerous Code
CHAPTER 5
The Future of Code
CHAPTER
YOUR FIRST CODE
All video games have code that makes them work.
T
he bell rings, and you rush to coding
club. Youre excited to continue
working on your video game. In the game,
a queen has to find her way through
a maze. On one side of your screen,
you see the maze and the character you
made. On the other side is a white space.
In the middle are colored blocks with
commands on them. These blocks will
make the queen move. You drag a block
to the white space. The command on the
block says
WHEN RUN . You drop more blocks
underneath it. They say
MOVE FORWARD , TURN
RIGHT , and MOVE FORWARD . When you click
the run button, your hero moves forward,
turns right, and moves forward again.
Your code is working!
Visual coding languages are easy
and fun ways to learn coding. A code, or
program, is simply a set of instructions
telling the computer what to do. Coding is
the act of writing those instructions.
Coding has been around longer than
computers themselves. Ada Lovelace
wrote the first code in 1843 for a
computer that existed only on paper.
She showed how the computer could be
programmed to do complex calculations.
Early computers were so big that they took up
entire rooms.
The first computers were not built
until the 1930s. A computer called
Colossus was designed during World
War II (19391945). But Colossus did not
have a written code to tell it what to do.
Instead, its programmers had to set the
computers plugs and switches in a new
position every time the computer ran.
Programmers soon realized
they needed an easier way to give
computers instructions. One of the first
programming languages, FORTRAN, was
invented in the 1950s. Other languages
soon followed.
Since then, both computers and
code have evolved. Now computers are
everywhere. They sit on our desks and
laps. We carry them in our pockets. Some
people even have computers in their
bodies to help with health problems. All
of these devices run on code.
Alan Turing was a coding pioneer whose work contributed
to Colossus.
HOW CODING WORKS
CHAPTER
A computers native language, or machine code, is
made up entirely of numbers.
C
omputers need specific instructions
to do anything. A program is a set of
instructions a computer follows. Coders
use a variety of programming languages.
These include Scratch, JavaScript, C,
Ruby, and many more.
But computers dont understand
programming languages without help.
The code needs to be translated
into the computers native language,
called machine code. The most basic
instructions are called binary . It is
a language made up of zeroes and
ones. Each digit tells a tiny switch in
the computer to be off or on. To tell
TRANSLATORS
Programming languages differ in how they are
translated into machine code. An interpreter