Introduction

Welcome to Scratch Programming for Teens! Scratch is a programming language developed by the MIT Media Lab for the purpose of teaching programming to teens and other first-time programmers. Scratch is a new programming language, initially released in May 2007. Scratch supports the development of computer games, interactive stories, graphic artwork and computer animation, and all sorts of other multimedia projects.

Scratch allows new programmers to create programs by snapping together blocks. Scratch consists of a programming language made up of different blocks and an easy to learn graphical development environment that includes a paint application for creating graphics and built-in sound editing capabilities. Scratch also comes with huge collections of sample applications as well as graphics and sound files, all of which you can use to create your own Scratch projects.

As demonstrated in Figure A.1, Scratch programs are made up of graphical blocks, which are snapped together. Scratch blocks resemble puzzle pieces in the way that they snap together. Scratch blocks can only be snapped together in ways that make sense, preventing new programmers from using them in invalid combinations. In this way, Scratch enforces proper programming syntax and ensures that new programmers learn the proper way to assemble and formulate programming logic.

Figure A.1. Script blocks are used as the basis for writing scripts that help bring applications to life.


Scratch’s development was inspired by the method that hip-hop DJs use to mix and scratch records to create new and unique music. In Scratch, new programmersare able to create new application projects that incorporate pre-built code blocks, graphics, and sound files in all kinds of new combinations. Scratch lets programmers modify applications on the fly, allowing changes to be made even while Scratch applications are running. The result is an interactive, real-time programming environment that encourages experimentation and learning.

This book’s primary goal is to teach you everything you need to know to learn the basics of computer programming with Scratch. To help accomplish this goal, this book will emphasize learning by doing through the development of a series of fun and interesting exercises.

Why Scratch?

Scratch provides everything needed to begin developing computer games, multimedia presentations, interactive stories, graphic artwork, and computer animation. Scratch can be used to play digital music and sound effects. Scratch’s building block approach to programming sets it apart from other programming languages. This makes Scratch easier to learn. And yet Scratch provides plenty of programming power, allowing you to build very powerful application projects.

If you aspire to one day become a professional programmer, you will find that Scratch provides everything needed to build a foundation from which you can make the transition. Scratch also packs all of the programming power and punch needed to satisfy the programming needs of most computer enthusiasts and hobbyists.

Who Should Read This Book?

Scratch Programming for Teens is designed to provide all of the instruction that a first-time programmer requires to quickly get up and running. Previous programming experience will certainly be helpful, but it is by no means a requirement of this book. This book makes no assumptions about your computer background other than that you are comfortable working with one of the operations systems supported by Scratch.

This book provides everything you need to get started with Scratch. Before you know it, you will be creating all kinds of projects, incorporating graphics, sound, and animation. As you learn how to program with Scratch, you will learn programming principles and techniques that you can later apply to other programming languages. As such, you will be able to apply what you learn about programming with Scratch to other programming languages like Microsoft Visual Basic and AppleScript.

What You Need to Begin

Obviously, the first thing you need is a copy of Scratch. Scratch is available for free download at the Scratch website located at http://scratch.mit.edu/download. You can also download a copy from the CD included in the back of the book. You also need good instruction, which you will find in this book. In addition to Scratch and this book, you need a computer running a supported operating system, which also meets Scratch’s minimum system requirements.

Supported Operating Systems

Scratch can be run on computers using either Microsoft or Macintosh operating systems. Specifically, Scratch can be installed on a computer running any of the following operating systems.

  • Microsoft Windows 98/ME

  • Microsoft Windows NT/2000

  • Microsoft Windows XP/Vista

  • Mac OS X Version 10.3 or higher

All of the figures and examples in this book will be shown using Scratch 1.2.1 running on computers using either Microsoft Vista or Mac OS X 10.5. If you are going to be working with Scratch on a different version of Windows or Mac OS X, you may notice small differences in the way things look. However, all major Scratch features and functionality should work the same and you should not have any problems following along with the instruction provided in this book.

Note

There is no official Linux version of Scratch currently available. However, members of the Scratch community have created different Scratch implementations for Linux. An example of one such implementation is available at http://tcpdpodcast.org/scratch.html.


Minimum System Requirements

Scratch does not impose any additional hardware requirements over and above those required by the operating system. However, as Table A.1 shows, Scratch does impose screen resolution and disk space requirements, which must be met for Scratch to run.

Table A.1. Scratch Minimum System Requirements
RequirementRecommended
Screen Resolution1024 × 768 (16-bit color)
Hard Disk120 MB

To work with Scratch, you must be able to display its graphical interface, also referred to as its integrated development environment or IDE. This interface requires that the computer’s screen resolution be set to 1024 × 768 or higher. Anything less and part of the interface will disappear off the screen. Scratch comes packed with all kinds of graphics and audio files that you can use when creating new Scratch projects. As a result, your computer must have at least an extra 120 MB of hard disk space in order to install Scratch.

Note

One of the really neat things about Scratch is the ability to share Scratch application projects with others on the Internet at the Scratch website (Scratch.mit.edu). To participate in this experience, your computer needs to have Java installed. Mac OS X comes with Java pre-installed. However, by default, Microsoft Windows does not. So, if you are a Windows user and you have not yet installed Java on your computer, you can do so by visiting http://java.com/en/download.index.jsp.


Of course, Scratch’s minimum hardware requirements are just that, minimum requirements. If your computer’s memory and processor exceed the minimum requirements of the operating system, things will run a lot faster and you will be a lot happier. In addition, you will need extra hard drive space beyond the 120 MB minimum required to install Scratch to have a place to store your creations. Scratch lets you create projects that incorporate the use of sound, both as input and output. To take advantage of this feature, your computer will need both speakers and a microphone.

How This Book Is Organized

Scratch Programming for Teens is organized into four parts. This book was written with the expectation that you will read it sequentially, from cover to cover. However, if you have some previous programming experience, you may instead want to jump around a bit, focusing on topics that interest you the most.

Part I of this book is made up of four chapters that provide an introduction to Scratch and its development environment. You will also learn about the different components that make up Scratch projects and then learn how to create and execute Scratch projects.

Part II consists of eight chapters, each of which is designed to provide instruction on how to work with different types of Scratch blocks. You will learn how to use blocks that move things around, store and retrieve data, as well as perform math and conditional and repetitive logic. You will also learn how to integrate sound and draw lines and shapes.

Part III of this book is made up of three chapters, each of which focuses on a different advanced topic. These topics include learning how to share your Scratch projects with others on the Internet, how to create Scratch projects that use the Scratch Board, and how to find and fix program errors that prevent your Scratch projects from working like you want them to.

Part IV is made up of two appendices and a glossary. The first appendix reviews the list of sample Scratch projects that you will learn how to develop as you make your way through this book. The second appendix provides a list of websites and reading materials that you will want to explore to continue learning more about Scratch and to further your programming knowledge.

Conventions Used in This Book

One of the primary objectives of this book is for it to be easy to read and understand. To help support this objective, a number of simple conventions have been used throughout the book to highlight critical information and help emphasize specific points. These conventions are briefly described below.

  • Italics. Key terms that you will want to understand and remember are highlighted using italics the first time that they are instructed. So remember, anytime you see a term in italics, take an extra moment to think about it and understand its meaning or purpose.

Note

Notes are used to provide additional information about a topic, feature, or idea to better help you understand its impact or implications.


Tip

Tips are used to point out programming shortcuts that will help make you a better and more efficient programmer.


Caution

Cautions are used to identify areas where you are likely to run into problems and then provide advice on how to deal with the problem or prevent problems from occurring, making you a better, more efficient, and much happier programmer.


 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.12.186