Introduction - Learn to Program with Scratch: A Visual Introduction to Programming with Games, Art, Science, and Math (2014)

Learn to Program with Scratch: A Visual Introduction to Programming with Games, Art, Science, and Math (2014)

Introduction

Scratch is a visual programming language that provides a rich learning environment for people of all ages. It allows you to create interactive, media-rich projects, including animated stories, book reports, science projects, games, and simulations. Scratch’s visual programming environment enables you to explore areas of knowledge that would otherwise be inaccessible. It provides a full set of multimedia tools you can use to create wonderful applications, and you can do so more easily than with other programming languages.

In many ways, Scratch promotes problem-solving skills—important in all areas of life, not just programming. The environment provides immediate feedback, allowing you to check your logic quickly and easily. The visual structure makes it a simple matter to trace the flow of your programs and refine your way of thinking. In essence, Scratch makes the ideas of computer science accessible. It makes learning intrinsically motivating; fosters the pursuit of knowledge; and encourages hands-on, self-directed learning through exploration and discovery. The barriers to entry are very low, while the ceiling is limited only by your creativity and imagination.

A lot of books claim to teach you how to program using Scratch. Most target very young readers and present only a few simple applications that guide the reader through Scratch’s user interface. These books are more about Scratch than programming. The goal of this book, by contrast, is to teach fundamental programming concepts using Scratch as a tool, as well as to unveil the capabilities of Scratch as a powerful vehicle for both teaching and learning.

Whom This Book Is For

This book is for anyone eager to explore computer science. It teaches the fundamentals of programming, and it can be used as a textbook for middle and high school students or as a self-study guide. The book can also be used at the college level to teach elementary programming concepts to students from different backgrounds or as a companion textbook that provides an introduction to such a course.

Teachers who want to use Scratch in the classroom can also benefit from the deeper understanding of programming to be found in this book. You’ll develop the skills you need to engage students with Scratch in meaningful ways that are compatible with their needs.

The book assumes no prior programming experience and, for the most part, no mathematics beyond what is taught in high school. Some of the advanced simulations can be skipped without causing any learning gap.

A Note to the Reader

The beauty of being a programmer is that you can create. Think about it: You come up with an idea and use your keyboard for a couple of hours, and a new software project comes to life! Like any new skill, however, programming takes practice. Along the way, you’ll most likely make mistakes—but don’t give up. Take time to reflect on the concepts and experiment with different techniques until you master them. And then move on to learn something new.

Features

This book provides a hands-on, problem-solving approach to learning programming and related concepts in computer science. With this approach, I hope to cultivate readers’ imaginations and make the computer-programming experience available to everyone.

With that in mind, the book is project oriented. I’ll present concepts with detailed explanations, and then together, we’ll develop a number of applications that illustrate those concepts. The emphasis is on problem solving rather than on Scratch’s particular features..

The examples presented in these pages demonstrate the wide range of knowledge you can explore using Scratch. These examples were selected carefully to explain programming concepts and to show how you can use Scratch to increase your understanding of other topics.

The Try It Out exercises and the problems at the end of each chapter are designed to challenge your programming skills. They also suggest new ideas that incorporate the studied concepts into larger problems. I encourage you to attempt these exercises and to come up with your own programming problems. Solving problems of your own shows that you’ve developed a solid understanding of programming.

Organization of This Text

The first three chapters of this book introduce Scratch as a powerful tool for drawing geometric shapes and creating media-rich applications. They’ll get you started quickly and easily, while the rest of the book focuses on the programming constructs supported in Scratch.

§ Chapter 1 introduces Scratch’s programming environment, the available command blocks, and the process of creating simple programs.

§ Chapter 2 reviews the motion commands and introduces Scratch’s drawing capabilities.

§ Chapter 3 discusses Scratch’s sound and graphics commands.

§ Chapter 4 introduces procedures as a way to write structured, modular programs. We jump into procedures here to enforce good programming style from the beginning.

§ Chapter 5 explores how you can use variables to keep track of information. This chapter also explains how to ask users questions and get answers, paving the way for building a wide range of interactive applications.

§ Chapter 6 outlines decision making and controlling the flow of programs.

§ Chapter 7 discusses in detail the repetition structures available in Scratch and explains how to use them through concrete examples.

§ Chapter 8 discusses the string data type and presents a collection of useful string-manipulation routines.

§ Chapter 9 introduces lists as containers of items and demonstrates how you can use them to create powerful programs.

All chapters also include several complete projects that can be used as a guide for creating similar applications in many learning settings. By the time you finish this book, you should be able to tackle just about any programming project on your own!

Conventions Used

We use a few text styles to correspond with the text in the Scratch interface:

§ Scratch block names are in this style: when green flag clicked.

§ Sprite names and variables are in this style: Ball.

Filename.sb2

The file(s) that you need when reading a particular section are named in the margin (see the example on the left), and Try It Out exercises are shown like this:

TRY IT OUT

This is something for you to try.