Learn to Program with Scratch

A Visual Introduction to Programming with Games, Art, Science, and Math

by Majed Marji

February 2014, 288 pp.
ISBN: 978-1-59327-543-3
Full Color

Scratch is a fun, free, beginner-friendly programming environment where you connect blocks of code to build programs. While most famously used to introduce kids to programming, Scratch can make computer science approachable for people of any age. Rather than type countless lines of code in a cryptic programming language, why not use colorful command blocks and cartoon sprites to create powerful scripts?

In Learn to Program with Scratch, author Majed Marji uses Scratch to explain the concepts essential to solving real-world programming problems. The labeled, color-coded blocks plainly show each logical step in a given script, and with a single click, you can even test any part of your script to check your logic. You’ll learn how to:

  • Harness the power of repeat loops and recursion
  • Use if/else statements and logical operators to make decisions
  • Store data in variables and lists to use later in your program
  • Read, store, and manipulate user input
  • Implement key computer science algorithms like a linear search and bubble sort

Hands-on projects will challenge you to create an Ohm’s law simulator, draw intricate patterns, program sprites to mimic line-following robots, create arcade-style games, and more! Each chapter is packed with detailed explanations, annotated illustrations, guided examples, lots of color, and plenty of exercises to help the lessons stick. Learn to Program with Scratch is the perfect place to start your computer science journey, painlessly.


About the Author

Majed Marji is a senior development engineer at General Motors and an adjunct faculty member at Wayne State University in Michigan. He holds a PhD in electrical engineering from Wayne State University and an MBA in strategic management from Davenport University.


Table of Contents

Introduction

Chapter 1: Getting Started
Chapter 2: Motion and Drawing
Chapter 3: Looks and Sound
Chapter 4: Procedures
Chapter 5: Variables
Chapter 6: Making Decisions
Chapter 7: Repetition: Definite and Indefinite Loops
Chapter 8: String Processing
Chapter 9: Lists

Appendix A

View the detailed Table of Contents (PDF)
View the Index (PDF)


About the Online Resources

Learn to Program with Scratch includes many useful online resources, which you can download at the links below.

As you read, open the Scratch scripts (.sb2 files) mentioned in each chapter to follow along with the examples. Whenever you solve a practice problem or Try It Out exercise, you can check your answers with the files in the Solutions folder. Learn even more about Scratch by reading the information about the Paint Editor, mathematical functions, and drawing geometric shapes in the Extra Resources folder. If you want to try out more guided examples, you’ll even find extra games and simulations to go along with several chapters in the Bonus Applications folder.

  • Chapter Scripts: This folder contains all the scripts mentioned in the book.
  • Solutions: This folder contains the solutions to all problems and Try It Out exercises (where applicable) in the book.
  • Extra Resources: This folder contains three PDF files that provide more in-depth information on the Paint Editor, Scratch’s mathematical functions, and drawing geometric shapes.
  • Bonus Applications: This folder contains bonus Scratch applications that you can study on your own. The file Bonus Applications.pdf walks you through them with detailed explanations.

How to Open .sb2 Project Files in Scratch

Open your browser and go to the Scratch website. If you have an account, click “Sign In” and enter your credentials to log on. (That will let you save your work, but you can still use Scratch even without an account!)

Click “Create” to open the Scratch programming environment. From there, click “File” followed by “Upload from your computer.” Go to the folder where you extracted the contents of the Chapter_Scripts.zip file, and select the script you’d like to open. When asked, “Replace contents of the current project?” click OK.

You should now be able to edit your Scratch project!


Reviews

“Fills a void in the current literature on how to play with and manipulate Scratch.”
—School Library Journal

“Ups the ante on Scratch programming for kids and adults.”
—Phil Shapiro, Make (Read More)

“Marji has expertly expanded the range of Scratch’s intended audience.”
—Katherine Noone, Voice of Youth Advocates

Featured on Boing Boing!

“This is another wonderful programming book for kids from No Starch Press.”
—Richard Bejtlich, Chief Security Strategist, FireEye (Read More)

Leave a comment