Preface to the Third Edition xvPreface to the Second Edition xviiPreface to the First Edition xixAbout the Authors xxv1 INTRODUCTION 11 Introduction to Computer Science and Media Computation 31.1 What Is Computer Science About? 31.2 Programming Languages 61.3 What Computers Understand 81.4 Media Computation: Why Digitize Media? 111.5 Computer Science for Everyone 121.5.1 It's About Communication 121.5.2 It's About Process 122 Introduction to Programming 162.1 Programming Is About Naming 162.1.1 Files and Their Names 182.2 Programming in Python 192.3 Programming in JES 202.4 Media Computation in JES 212.4.1 Showing a Picture 252.4.2 Playing a Sound 272.4.3 Naming Values 282.5 Making a Program 312.5.1 Variable Recipes: Real Math-Like Functions That Take Input 343 Modifying Pictures Using Loops 403.1 How Pictures Are Encoded 413.2 Manipulating Pictures 463.2.1 Exploring Pictures 513.3 Changing Color Values 533.3.1 Using Loops in Pictures 533.3.2 Increasing/Decreasing Red (Green, Blue) 553.3.3 Testing the Program: Did That Really Work? 603.3.4 Changing One Color at a Time 613.4 Creating a Sunset 623.4.1 Making Sense of Functions 633.5 Lightening and Darkening 673.6 Creating a Negative 683.7 Converting to Grayscale 694 Modifying Pixels in a Range 754.1 Copying Pixels 754.1.1 Looping Across the Pixels with range 764.2 Mirroring a Picture 784.3 Copying and Transforming Pictures 864.3.1 Copying 864.3.2 Creating a Collage 944.3.3 General Copying 964.3.4 Rotation 984.3.5 Scaling 1005 Picture Techniques with Selection and Combination 1075.1 Replacing Colors: Red-Eye, Sepia Tones, and Posterizing 1085.1.1 Reducing Red-Eye 1115.1.2 Sepia-Toned and Posterized Pictures: Using Conditionals to Choose the Color 1135.2 Combining Pixels: Blurring 1185.3 Comparing Pixels: Edge Detection 1195.4 Blending Pictures 1225.5 Background Subtraction 1255.6 Chromakey 1275.7 Drawing on Images 1315.7.1 Drawing with Drawing Commands 1325.7.2 Vector and Bitmap Representations 1335.8 Selecting Without Re-Testing 1355.9 Programs as Specifying Drawing Process 1365.9.1 Why Do We Write Programs? 1392 SOUND 1436 Modifying Sounds Using Loops 1456.1 How Sound Is Encoded 1456.1.1 The Physics of Sound 1456.1.2 Exploring How Sounds Look 1496.1.3 Encoding the Sound 1516.1.4 Binary Numbers and Two's Complement 1536.1.5 Storing Digitized Sounds 1546.2 Manipulating Sounds 1566.2.1 Open Sounds and Manipulating Samples 1566.2.2 Using the JES MediaTools 1596.2.3 Looping 1616.3 Changing the Volume of Sounds 1616.3.1 Increasing Volume 1616.3.2 Did That Really Work? 1626.3.3 Decreasing Volume 1666.3.4 Making Sense of Functions, in Sounds 1676.4 Normalizing Sounds 1676.4.1 Generating Clipping 1697 Modifying Samples in a Range 1747.1 Manipulating Different Sections of the Sound Differently 1747.2 Splicing Sounds 1777.3 General Clip and Copy 1837.4 Reversing Sounds 1867.5 Mirroring 1877.6 On Functions and Scope 1888 Making Sounds by Combining Pieces 1938.1 Composing Sounds Through Addition 1938.2 Blending Sounds 1958.3 Creating an Echo 1968.3.1 Creating Multiple Echoes 1978.3.2 Creating Chords 1988.4 How Sampling Keyboards Work 1988.4.1 Sampling as an Algorithm 2028.5 Additive Synthesis 2038.5.1 Making SineWaves 2038.5.2 Adding SineWaves Together 2058.5.3 Checking Our Result 2068.5.4 SquareWaves 2078.5.5 TriangularWaves 2108.6 Modern Music Synthesis 2118.6.1 MP3 2128.6.2 MIDI 2129 Building Bigger Programs 2169.1 Designing Programs Top-Down 2179.1.1 A Top-Down Design Example 2189.1.2 Designing the Top-Level Function 2199.1.3 Writing the Subfunctions 2219.2 Designing Programs Bottom-Up 2259.2.1 An Example Bottom-Up Process 2269.3 Testing Your Program 2269.3.1 Testing the Edge Conditions 2289.4 Tips on Debugging 2289.4.1 Finding which Statement to Worry About 2309.4.2 Seeing the Variables 2309.4.3 Debugging the Adventure Game 2329.5 Algorithms and Design 2359.6 Running Programs Outside of JES 2363 TEXT, FILES,NETWORKS,DATABASES, AND UNIMEDIA 24210 Creating and Modifying Text 24410.1 Text as Unimedia 24410.2 Strings: Making and Manipulating Strings 24510.3 Manipulating Parts of Strings 24810.3.1 String Methods: Introducing Objects and Dot Notation 24810.3.2 Lists: Powerful, Structured Text 25110.3.3 Strings Have No Font 25310.4 Files: Places to Put Your Strings and Other Stuff 25410.4.1 Opening and Manipulating Files 25510.4.2 Generating Form Letters 25710.4.3 Writing Out Programs 25810.5 The Python Standard Library 26210.5.1 More on Import and Your Own Modules 26310.5.2 Another Fun Module: Random 26310.5.3 A Sampling of Python Standard Libraries 26511 Advanced Text Techniques: Web and Information 27011.1 Networks: Getting Our Text from the Web 27011.2 Using Text to Shift Between Media 27711.3 Moving Information Between Media 28011.4 Using Lists As Structured Text for Media Representations 28211.5 Hiding Information in a Picture 28412 Making Text for the Web 28912.1 HTML: The Notation of the Web 28912.2 Writing Programs to Generate HTML 29412.3 Databases: A Place to Store Our Text 29912.3.1 Relational Databases 30112.3.2 An Example Relational Database Using HashTables 30212.3.3 Working with SQL 30412.3.4 Using a Database to Build Web Pages 3074 MOVIES 31113 Creating and Modifying Movies 31313.1 Generating Animations 31413.2 Working with Video Source 32213.2.1 Video Manipulating Examples 32313.3 Building a Video Effect Bottom-Up 3265 TOPICS IN COMPUTER SCIENCE 33314 Speed 33514.1 Focusing on Computer Science 33514.2 What Makes Programs Fast? 33514.2.1 What Computers Really Understand 33614.2.2 Compilers and Interpreters 33714.2.3 What Limits Computer Speed? 34114.2.4 Does It Really Make a Difference? 34314.2.5 Making Searching Faster 34514.2.6 Algorithms That Never Finish or Can't Be Written 34714.2.7 Why Is Photoshop Faster Than JES? 34914.3 What Makes a Computer Fast? 34914.3.1 Clock Rates and Actual Computation 35014.3.2 Storage: What Makes a Computer Slow? 35114.3.3 Display 35215 Functional Programming 35515.1 Using Functions to Make Programming Easier 35515.2 Functional Programming with Map and Reduce 35815.3 Functional Programming for Media 36215.3.1 Media Manipulation Without Changing State 36315.4 Recursion: A Powerful Idea 36415.4.1 Recursive Directory Traversals 36915.4.2 Recursive Media Functions 37116 Object-Oriented Programming 37616.1 History of Objects 37616.2 Working with Turtles 37816.2.1 Classes and Objects 37816.2.2 Sending Messages to Objects 37916.2.3 Objects Control Their State 38116.3 Teaching Turtles New Tricks 38316.3.1 Overriding an Existing Turtle Method 38516.3.2 Using Turtles for More 38616.4 An Object-Oriented Slide Show 39016.4.1 Making the Slide Class More Object-Oriented 39316.5 Object-Oriented Media 39516.6 Joe the Box 40016.7 Why Objects? 401APPENDIX 406A Quick Reference to Python 406A.1 Variables 406A.2 Function Creation 407A.3 Loops and Conditionals 407A.4 Operators and Representation Functions 408A.5 Numeric Functions 409A.6 Sequence Operations 409A.7 String Escapes 409A.8 Useful String Methods 409A.9 Files 410A.10 Lists 410A.11 Dictionaries, Hash Tables, or Associative Arrays 410A.12 External Modules 410A.13 Classes 411A.14 Functional Methods 411Bibliography 412Index 415
Barbara Ericson is a research scientist and the Director of Computing Outreach for the College of Computing at Georgia Tech. She has been working on improving introductory computing education for over 5 years. She enjoys the diversity of the types of problems she has worked on over the years in computing including computer graphics, artificial intelligence, medicine, and object-oriented programming. Mark Guzdial is a Professor in the School of Interactive Computing at Georgia Tech. An award-winning teacher and active researcher in computing education, he holds a joint Ph.D. In Education and Computer Science from the University of Michigan. Dr. Guzdial directs Project "Georgia Computes!" which is an NSF funded alliance to improve computing education from pre-teen years to undergraduates. He is a member of the ACM Education Board and is a frequent contributor to the ACM SIGCSE (Computer Science Education) Symposium. Barbara Ericson and Mark Guzdial, are recipients of the 2010 Karl V. Karlstom Outstanding Educator Award for their contributions to broadening participation in computing. They created the Media Computation (MediaComp) approach, which motivates students to write programs that manipulate and create digital media, such as pictures, sounds, and videos. Now in use in nearly 200 schools around the world, this contextualized approach to introductory Computer Science attracts students not motivated by classical algorithmic problems addressed in traditional computer science education. They also lead "Georgia Computes!" an NSF-funded statewide alliance to increase the number and diversity of students in computing education across all of Georgia. Barbara Ericson directs the Institute for Computing Education at Georgia Tech. Mark Guzdial is director of the Contextualized Support for Learning at Georgia Tech. Together they have written three textbooks using the MediaComp approach to engage and inspire student learning in computing. The Karlstrom Award recognizes educators who advanced new teaching methodologies; effected new curriculum development in Computer Science and Engineering; or contributed to ACM's educational mission.