HOW SOFTWARE WORKS
The Magic Behind Encryption, CGI, Search Engines, and Other Everyday Technologies
by V. Anton Spraul
San Francisco
HOW SOFTWARE WORKS. Copyright 2015 by V. Anton Spraul.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.
Printed in USA
First printing
19 18 17 16 15 1 2 3 4 5 6 7 8 9
ISBN-10: 1-59327-666-4
ISBN-13: 978-1-59327-666-9
Publisher: William Pollock
Production Editor: Alison Law
Cover Illustration: Josh Ellingson
Interior Design: Octopod Studios
Developmental Editors: Hayley Baker, Seph Kramer, and Greg Poulos
Technical Reviewer: Randall Hyde
Copyeditor: Rachel Monaghan
Compositor: Susan Glinert Stevens
Proofreader: James Fraleigh
For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:
No Starch Press, Inc.
245 8th Street, San Francisco, CA 94103
phone: 415.863.9900;
www.nostarch.com
Library of Congress Cataloging-in-Publication Data:
Spraul, V. Anton.
How software works : the magic behind encryption, CGI, search engines, and other everyday technologies / by
V. Anton Spraul.
pages cm
Includes index.
Summary: A guide for non-technical readers that explores topics like data encryption; computer graphics
creation; password protection; video compression; how data is found in huge databases; how programs can work
together on the same problem without conflict; and how map software finds routes.-- Provided by publisher.
ISBN 978-1-59327-666-9 -- ISBN 1-59327-666-4
1. Electronic data processing--Popular works. 2. Computer software--Popular works. 3. Computer networks-
Popular works. I. Title.
QA76.5.S6663 2015
005.3--dc23
2015022623
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The information in this book is distributed on an As Is basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it.
About the Author
V. Anton Spraul has taught introductory programming and computer science to students from all over the world for more than 15 years. He is also the author of Think Like a Programmer (No Starch Press) and Computer Science Made Simple (Broadway).
About the Technical Reviewer
Randall Hyde is the author of The Art of Assembly Language and Write Great Code (both No Starch Press), and is also the co-author of The Waite Groups Microsoft Macro Assembler 6.0 Bible (Sams Publishing). Hyde taught assembly language at the University of California, Riverside, for more than a decade and has been programming software for nuclear reactor consoles for the past 12 years.
Contents in Detail
Acknowledgments
This book was shaped and guided by a platoon of talented editors: Alison Law, Greg Poulos, Seph Kramer, Hayley Baker, Randall Hyde, Rachel Monaghan, and the Big Fish of No Starch, Bill Pollock. Beyond the editorial staff, I appreciate the support and kindness of everyone Ive worked with at No Starch.
The two people who helped me the most, though, are Mary Beth and Madeline, the best wife and daughter I can imagine. Without their love and support, this book would not have been written.
Introduction
Science fiction author Arthur C. Clarke wrote that any sufficiently advanced technology is indistinguishable from magic. If we dont know how something works, then it might as well be explained by supernatural forces. By that standard, we live in an age of magic.
Software is woven into our lives, into everyday things like online transactions, special effects in movies, and streaming video. Were forgetting we used to live in a world in which the answer to a question wasnt just a Google search away, or where finding a route for a car trip began with unfolding a cumbersome map.
But few of us have any idea how all this software works. Unlike many innovations of the past, you cant take software apart to see what its doing. Everything happens on a computer chip that looks the same whether the device is performing an amazing task or isnt even turned on. Knowing how a program works seems to require spending years of study to become a programmer. So its no wonder that many of us assume that software is beyond our understanding, a collection of secrets known only to a technological elite. But thats wrong.
Who This Book Is For
Anyone can learn how software works. All you need is curiosity. Whether youre a casual fan of technology, a programmer in the making, or someone in between, this book is for you.
This book covers the most commonly used processes in software and does so without a single line of programming code. No prior knowledge of how computers operate is required. To make this possible, Ive simplified a few processes and clipped some details, but that doesnt mean these are mere high-level overviews; youll be getting the real goods, with enough details that youll truly understand how these programs do what they do.
Topics Covered
Computers are so ubiquitous in the modern world that the list of subjects I could cover seems endless. Ive chosen topics that are most central to our daily lives and with the most interesting explanations.
allows us to scramble our data so that only we can access it. When you lock your phone or password-protect a .zip file, youre using encryption. Well see how different scrambling techniques are combined in modern encryption software.
are the keys we use to lock our data and how we identify ourselves to remote systems. Youll see how passwords are used in encryption and learn the surprising steps that must be taken to keep passwords safe from attackers.
is what we need to safely purchase goods online or access our accounts. Locking data for transmission requires a different method of scrambling called public-key encryption. Youll discover how a secure web session requires all the techniques covered in the first three chapters.
is pure software magic, creating whole worlds out of mathematical descriptions. Youll discover how software took over traditional cel animation and then learn the key concepts behind making a complete movie set with software.
are impressive not just for their visuals but also for how they are created in mere fractions of a second. Well explore a host of clever tricks games use to produce stunning images when they dont have time for the techniques discussed in the previous chapter.